IAM - Add Validation on duplicate role names

This commit is contained in:
Bert Blommers 2019-11-11 08:21:42 +00:00
commit 422bca8e90
2 changed files with 25 additions and 0 deletions

View file

@ -898,6 +898,10 @@ class IAMBackend(BaseBackend):
permissions_boundary
),
)
if [role for role in self.get_roles() if role.name == role_name]:
raise EntityAlreadyExists(
"Role with name {0} already exists.".format(role_name)
)
clean_tags = self._tag_verification(tags)
role = Role(