Skip to content

Commit

Permalink
add more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
taraspos committed May 8, 2018
1 parent 077027c commit 0483b54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions S3/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def aws_credential_file(self):
# if header is missing, this could be deprecated credentials file format
# as described here: https://blog.csanchez.org/2011/05/
# then do the hacky-hack and add default header
# to be able to readt he file with PyConfigParser()
# to be able to read the file with PyConfigParser()
config_string = None
with open(aws_credential_file, 'r') as f:
config_string = '[default]\n' + f.read()
Expand All @@ -314,16 +314,16 @@ def get_key(profile, key, legacy_key, print_warning=True):
try:
result = config.get(profile, key)
except NoOptionError as e:
if print_warning:
if print_warning: # we may want to skip warning message for optional keys
warning("Couldn't find key '%s' for the AWS Profile '%s' in the credentials file '%s'" % (e.option, e.section, aws_credential_file))
if legacy_key:
if legacy_key: # if the legacy_key defined and original one wasn't found, try read the legacy_key
try:
key = legacy_key
profile = "default"
result = config.get(profile, key)
warning(
"Legacy configuratin key '%s' used, " % (key) +
"please use the standartized config format as described here: " +
"please use the standardized config format as described here: " +
"https://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks/"
)
except NoOptionError as e:
Expand Down

0 comments on commit 0483b54

Please sign in to comment.