Skip to content

Commit 9719604

Browse files
CaptainSameSameer Sharma
andauthored
SEC-19136 | DAR-2360 | clearly prefer boto3 session over aws profile before checking service boto creds (#145)
* SEC-19136 | prefer boto3 session over aws profile and then service boto creds * SEC-19136 | bump up version --------- Co-authored-by: Sameer Sharma <[email protected]>
1 parent b97f586 commit 9719604

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

service_configuration_lib/spark_config.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,13 @@ def get_aws_credentials(
148148
session['Credentials']['SecretAccessKey'],
149149
session['Credentials']['SessionToken'],
150150
)
151+
# use the boto3 session if provided
152+
elif session:
153+
return use_aws_profile(session=session)
154+
# use the aws profile if provided
151155
elif profile_name:
152-
return use_aws_profile(profile_name=profile_name, session=session)
156+
return use_aws_profile(profile_name=profile_name)
157+
# use the service specific boto creds if boto3 session or aws profile is not provided
153158
elif service != DEFAULT_SPARK_SERVICE:
154159
service_credentials_path = os.path.join(AWS_CREDENTIALS_DIR, f'{service}.yaml')
155160
if os.path.exists(service_credentials_path):
@@ -159,8 +164,8 @@ def get_aws_credentials(
159164
f'Did not find service AWS credentials at {service_credentials_path}. '
160165
'Falling back to user credentials.',
161166
)
162-
163-
return use_aws_profile(session=session)
167+
# try to get default aws profile creds if nothing else is provided
168+
return use_aws_profile()
164169

165170

166171
def use_aws_profile(

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
setup(
1919
name='service-configuration-lib',
20-
version='2.18.18',
20+
version='2.18.19',
2121
provides=['service_configuration_lib'],
2222
description='Start, stop, and inspect Yelp SOA services',
2323
url='https://github.com/Yelp/service_configuration_lib',

0 commit comments

Comments
 (0)