Created
June 20, 2014 10:37
-
-
Save kszarek/f89cac7ddc95562f4e8e to your computer and use it in GitHub Desktop.
SmartIAM class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from boto.exception import BotoServerError | |
from boto.iam import IAMConnection | |
__author__ = 'Krzysztof Szarek' | |
class SmartIAM(IAMConnection): | |
def create_user(self, user): | |
try: | |
return super(SmartIAM, self).create_user(user) | |
except BotoServerError as exception: | |
if exception.code == 'EntityAlreadyExists': | |
return super(SmartIAM, self).get_user(user) | |
else: | |
raise | |
def create_group(self, group): | |
try: | |
return super(SmartIAM, self).create_group(group) | |
except BotoServerError as exception: | |
if exception.code == 'EntityAlreadyExists': | |
return | |
else: | |
raise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment