Skip to content

Commit 4b23ec8

Browse files
authored
Register feature id for credentials set using boto2 config file (boto#3562)
* Register feature id for credentials set using boto2 config file
1 parent fbd2621 commit 4b23ec8

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

botocore/credentials.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,7 @@ def load(self):
14911491
access_key, secret_key = self._extract_creds_from_mapping(
14921492
credentials, self.ACCESS_KEY, self.SECRET_KEY
14931493
)
1494+
register_feature_id('CREDENTIALS_BOTO2_CONFIG_FILE')
14941495
return Credentials(
14951496
access_key, secret_key, method=self.METHOD
14961497
)

botocore/useragent.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
'FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED': 'c',
8181
'CREDENTIALS_CODE': 'e',
8282
'CREDENTIALS_ENV_VARS': 'g',
83+
'CREDENTIALS_BOTO2_CONFIG_FILE': 'x',
8384
'CREDENTIALS_HTTP': 'z',
8485
'CREDENTIALS_IMDS': '0',
8586
'BEARER_SERVICE_ENV_VARS': '3',

tests/functional/test_credentials.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,34 @@ def test_credential_context_override(self):
12811281
[],
12821282
'e',
12831283
),
1284+
# Test case 5: Credentials set with Boto2 config
1285+
(
1286+
{},
1287+
{},
1288+
[
1289+
patch(
1290+
"botocore.configloader.raw_config_parse",
1291+
return_value={
1292+
"Credentials": {
1293+
"aws_access_key_id": "FAKEACCESSKEY",
1294+
"aws_secret_access_key": "FAKESECRETKEY",
1295+
}
1296+
},
1297+
),
1298+
patch(
1299+
"botocore.credentials.ConfigProvider.load",
1300+
return_value=None,
1301+
),
1302+
patch(
1303+
"botocore.credentials.SharedCredentialProvider.load",
1304+
return_value=None,
1305+
),
1306+
patch(
1307+
"botocore.credentials.EnvProvider.load", return_value=None
1308+
),
1309+
],
1310+
'x',
1311+
),
12841312
],
12851313
)
12861314
def test_user_agent_feature_ids(

0 commit comments

Comments
 (0)