Skip to content

Commit

Permalink
Merge pull request #122 from GetSimpl/Fix/task-defination-create-error
Browse files Browse the repository at this point in the history
Fix/task defination create error
  • Loading branch information
shoan authored Feb 2, 2023
2 parents 05ce82b + ea1ca03 commit 0f43464
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
10 changes: 8 additions & 2 deletions cloudlift/config/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ def get_account_id(sts_client=None):

def get_user_id(sts_client=None):
sts_client = sts_client or client('sts')
response = client('iam').list_account_aliases()
return sts_client.get_caller_identity().get('Arn').split('/')[1], response['AccountAliases'][0]
username = ""
account = sts_client.get_caller_identity().get('Account')
user_id = (sts_client.get_caller_identity()['Arn'].split("/")[0]).split(":")[-1]
if user_id == "user":
username = sts_client.get_caller_identity().get('Arn').split('/')[1]
elif user_id == "assumed-role":
username = sts_client.get_caller_identity().get('Arn').split('assumed-role/')[1]
return username, account
2 changes: 1 addition & 1 deletion cloudlift/config/pre_flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from cloudlift.exceptions import UnrecoverableException
from cloudlift.config.logging import log_err


def check_sns_topic_exists(topic_name, environment):
session = boto3.session.Session()
sns_client = session.client('sns')
Expand All @@ -16,3 +15,4 @@ def check_sns_topic_exists(topic_name, environment):
"Unable to find SNS topic {topic_name} in {environment} environment".format(**locals()))
else:
raise UnrecoverableException(e.response['Error']['Message'])

4 changes: 2 additions & 2 deletions cloudlift/deployment/ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,14 @@ def apply_container_environment(self, container, new_environment):
old_environment
)
self._diff.append(diff)

container[u'secrets'] = [
{
"name": e,
"valueFrom": merged_environment[e]
} for e in merged_environment
]
if container[u'environment'] is not None:
container[u'environment'] = []

def validate_container_options(self, **container_options):
for container_name in container_options:
Expand Down Expand Up @@ -422,7 +423,6 @@ def get_task_definition(self, task_definition):
def update_task_definition(self, task_definition):
fargate_td = {}
if task_definition.requires_compatibilities and 'FARGATE' in task_definition.requires_compatibilities:

fargate_td = {
'requires_compatibilities': task_definition.requires_compatibilities or [],
'cpu' : task_definition.cpu or u'',
Expand Down
2 changes: 1 addition & 1 deletion cloudlift/version/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.5.6'
VERSION = '1.5.7'

0 comments on commit 0f43464

Please sign in to comment.