[aws] Change IAM role name parsing to come from the ARN (#45534)
This commit is contained in:
parent
485320aab8
commit
fe6b7f6b5d
1 changed files with 2 additions and 2 deletions
|
@ -467,8 +467,8 @@ class Ec2Metadata(object):
|
|||
new_fields = {}
|
||||
for key, value in fields.items():
|
||||
split_fields = key[len(uri):].split('/')
|
||||
if len(split_fields) == 3 and split_fields[0:2] == ['iam', 'security-credentials']:
|
||||
new_fields[self._prefix % "iam-instance-profile-role"] = split_fields[2]
|
||||
if len(split_fields) == 2 and split_fields[0:2] == ['iam', 'info_instanceprofilearn']:
|
||||
new_fields[self._prefix % "iam-instance-profile-role"] = value.split('/')[1]
|
||||
if len(split_fields) > 1 and split_fields[1]:
|
||||
new_key = "-".join(split_fields)
|
||||
new_fields[self._prefix % new_key] = value
|
||||
|
|
Loading…
Reference in a new issue