Toggle navigation
Toggle navigation
This project
Loading...
Sign in
서승완
/
kappa
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
James Cooper
2016-06-12 16:12:44 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ae5c4812cac3043ca87e7139dad64b70a29555a9
ae5c4812
1 parent
31476b98
role.py: only strip 'Role' from 'get_role' response if present (passes placebo tests)
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
kappa/role.py
kappa/role.py
View file @
ae5c481
...
...
@@ -38,11 +38,13 @@ class Role(object):
Path
=
'/kappa/'
def
__init__
(
self
,
context
,
config
):
def
__init__
(
self
,
context
,
config
,
iam_client
=
None
):
self
.
_context
=
context
self
.
_config
=
config
self
.
_iam_client
=
kappa
.
awsclient
.
create_client
(
'iam'
,
context
.
session
)
self
.
_iam_client
=
iam_client
if
not
iam_client
:
self
.
_iam_client
=
kappa
.
awsclient
.
create_client
(
'iam'
,
context
.
session
)
self
.
_arn
=
None
@property
...
...
@@ -62,7 +64,9 @@ class Role(object):
def
_get_role
(
self
):
try
:
response
=
self
.
_iam_client
.
call
(
'get_role'
,
RoleName
=
self
.
name
)
return
response
[
'Role'
]
if
response
and
'Role'
in
response
:
response
=
response
[
'Role'
]
return
response
except
ClientError
as
e
:
if
e
.
response
[
'Error'
][
'Code'
]
!=
'NoSuchEntity'
:
LOG
.
exception
(
'Error getting role'
)
...
...
Please
register
or
login
to post a comment