Remove boolean check for underscore in IAM role (#38664)

Underscore is a valid character in an IAM role, per the docs https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html
This commit is contained in:
Vinay Dandekar 2018-04-13 08:46:26 -04:00 committed by Ryan Brown
parent ed25b56772
commit bed5f7317d

View file

@ -458,7 +458,7 @@ 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'] and '_' not in split_fields[2]:
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) > 1 and split_fields[1]:
new_key = "-".join(split_fields)