Browse code

Fixes #674 : When using AWS_CREDENTIAL_FILE, crash in case of invalid key in .aws/credentials file + updated the code for actual name of the keys.

Florent Viard authored on 2015/12/09 23:29:28
Showing 1 changed files
... ...
@@ -210,17 +210,19 @@ class Config(object):
210 210
         if len(cred_content)>0:
211 211
             for line in cred_content.splitlines():
212 212
                 is_data = r_data.match(line)
213
-                is_data = r_data.match(line)
214 213
                 if is_data:
215 214
                     data = is_data.groupdict()
216 215
                     if r_quotes.match(data["value"]):
217 216
                         data["value"] = data["value"][1:-1]
218
-                    if data["orig_key"]=="AWSAccessKeyId":
217
+                    if data["orig_key"] == "AWSAccessKeyId" \
218
+                       or data["orig_key"] == "aws_access_key_id":
219 219
                         data["key"] = "access_key"
220
-                    elif data["orig_key"]=="AWSSecretKey":
220
+                    elif data["orig_key"]=="AWSSecretKey" \
221
+                       or data["orig_key"]=="aws_secret_access_key":
221 222
                         data["key"] = "secret_key"
222 223
                     else:
223
-                        del data["key"]
224
+                        debug("env_config: key = %r will be ignored", data["orig_key"])
225
+
224 226
                     if "key" in data:
225 227
                         Config().update_option(data["key"], data["value"])
226 228
                         if data["key"] in ("access_key", "secret_key", "gpg_passphrase"):