1414
1515from config import *
1616
17- # Back compatability with old config requirements
18- if ':' in SQS_DEAD_LETTER_QUEUE :
19- SQS_DEAD_LETTER_QUEUE = SQS_DEAD_LETTER_QUEUE .rsplit (':' ,1 )[1 ]
20-
2117WAIT_TIME = 60
2218MONITOR_TIME = 60
2319
5450 ]
5551}
5652
57- SQS_DEFINITION = {
58- "DelaySeconds" : "0" ,
59- "MaximumMessageSize" : "262144" ,
60- "MessageRetentionPeriod" : "1209600" ,
61- "ReceiveMessageWaitTimeSeconds" : "0" ,
62- "RedrivePolicy" : "{\" deadLetterTargetArn\" :\" " + SQS_DEAD_LETTER_QUEUE + "\" ,\" maxReceiveCount\" :\" 10\" }" ,
63- "VisibilityTimeout" : str (SQS_MESSAGE_VISIBILITY )
64- }
65-
6653
6754#################################
6855# AUXILIARY FUNCTIONS
6956#################################
7057
7158def generate_task_definition (AWS_PROFILE ):
72- taskRoleArn = False
7359 task_definition = TASK_DEFINITION .copy ()
7460
7561 config = configparser .ConfigParser ()
@@ -86,6 +72,7 @@ def generate_task_definition(AWS_PROFILE):
8672 print ("Using role for credentials" , config [profile_name ]['role_arn' ])
8773 taskRoleArn = config [profile_name ]['role_arn' ]
8874 else :
75+ taskRoleArn = False
8976 if config .has_option (profile_name , 'source_profile' ):
9077 creds = configparser .ConfigParser ()
9178 creds .read (f"{ os .environ ['HOME' ]} /.aws/credentials" )
@@ -95,6 +82,11 @@ def generate_task_definition(AWS_PROFILE):
9582 elif config .has_option (profile_name , 'aws_access_key_id' ):
9683 aws_access_key = config [profile_name ]['aws_access_key_id' ]
9784 aws_secret_key = config [profile_name ]['aws_secret_access_key' ]
85+ elif profile_name == 'default' :
86+ creds = configparser .ConfigParser ()
87+ creds .read (f"{ os .environ ['HOME' ]} /.aws/credentials" )
88+ aws_access_key = creds ['default' ]['aws_access_key_id' ]
89+ aws_secret_key = creds ['default' ]['aws_secret_access_key' ]
9890 else :
9991 print ("Problem getting credentials" )
10092 task_definition ['containerDefinitions' ][0 ]['environment' ] += [
@@ -108,7 +100,7 @@ def generate_task_definition(AWS_PROFILE):
108100 }]
109101
110102 sqs = boto3 .client ('sqs' )
111- queue_name , dead_url = get_queue_url (sqs )
103+ queue_name = get_queue_url (sqs , SQS_QUEUE_NAME )
112104 task_definition ['containerDefinitions' ][0 ]['environment' ] += [
113105 {
114106 'name' : 'APP_NAME' ,
0 commit comments