Duplicate user needs to be EntityAlreadyExists error code.
This commit is contained in:
parent
3a38a2a1a7
commit
587893f0c7
@ -13,9 +13,9 @@ class IAMNotFoundException(RESTError):
|
||||
class IAMConflictException(RESTError):
|
||||
code = 409
|
||||
|
||||
def __init__(self, message):
|
||||
def __init__(self, code='Conflict', message=""):
|
||||
super(IAMConflictException, self).__init__(
|
||||
"Conflict", message)
|
||||
code, message)
|
||||
|
||||
|
||||
class IAMReportNotPresentException(RESTError):
|
||||
|
@ -344,7 +344,7 @@ class IAMBackend(BaseBackend):
|
||||
|
||||
def create_user(self, user_name, path='/'):
|
||||
if user_name in self.users:
|
||||
raise IAMConflictException("User {0} already exists".format(user_name))
|
||||
raise IAMConflictException("EntityAlreadyExists", "User {0} already exists".format(user_name))
|
||||
|
||||
user = User(user_name, path)
|
||||
self.users[user_name] = user
|
||||
|
Loading…
Reference in New Issue
Block a user