Corrected bug in IAM delete_role() due to overloading of name 'role' … (#3019)
* Corrected bug in IAM delete_role() due to overloading of name 'role' in function * PR-requested fixes: added region to tests boto client create, reformatted with black Co-authored-by: Joseph Weitekamp <jweite@amazon.com>
This commit is contained in:
parent
97a6e8d9e8
commit
b7a1b666a8
2 changed files with 35 additions and 2 deletions
|
|
@ -1148,8 +1148,8 @@ class IAMBackend(BaseBackend):
|
|||
def delete_role(self, role_name):
|
||||
role = self.get_role(role_name)
|
||||
for instance_profile in self.get_instance_profiles():
|
||||
for role in instance_profile.roles:
|
||||
if role.name == role_name:
|
||||
for profile_role in instance_profile.roles:
|
||||
if profile_role.name == role_name:
|
||||
raise IAMConflictException(
|
||||
code="DeleteConflict",
|
||||
message="Cannot delete entity, must remove roles from instance profile first.",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue