Skip to content

Commit

Permalink
Merge pull request getmoto#367 from spg/fix/iam_get_role
Browse files Browse the repository at this point in the history
IAM: unnecessary check for role
  • Loading branch information
spulec committed Jun 30, 2015
2 parents 185b49a + 9a2e7ad commit a3d5c77
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions moto/iam/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,26 +256,17 @@ def get_roles(self):

def put_role_policy(self, role_name, policy_name, policy_json):
role = self.get_role(role_name)
if role:
role.put_policy(policy_name, policy_json)
else:
raise BotoServerError(404, 'Not Found')
role.put_policy(policy_name, policy_json)

def get_role_policy(self, role_name, policy_name):
role = self.get_role(role_name)
if role:
for p, d in role.policies.items():
if p == policy_name:
return p, d
else:
raise BotoServerError(404, 'Not Found')
for p, d in role.policies.items():
if p == policy_name:
return p, d

def list_role_policies(self, role_name):
role = self.get_role(role_name)
if role:
return role.policies.keys()
else:
raise BotoServerError(404, 'Not Found')
return role.policies.keys()

def create_instance_profile(self, name, path, role_ids):
instance_profile_id = random_resource_id()
Expand Down

0 comments on commit a3d5c77

Please sign in to comment.