user create v2.0 depends on tenantId in response

User create for v2.0 no longer always contains a tenantId in the
response. Add a guard to check for tenantId first before pop'ing it.

Change-Id: I428dbc26520bb86efad33768ce04f584217ad168
Closes-Bug: #1352119
This commit is contained in:
Steve Martinelli 2014-08-04 00:04:13 -04:00
parent 75e8490e54
commit e2ebeb7fdc

@ -99,9 +99,10 @@ class CreateUser(show.ShowOne):
# NOTE(dtroyer): The users.create() method wants 'tenant_id' but
# the returned resource has 'tenantId'. Sigh.
# We're using project_id now inside OSC so there.
user._info.update(
{'project_id': user._info.pop('tenantId')}
)
if 'tenantId' in user._info:
user._info.update(
{'project_id': user._info.pop('tenantId')}
)
info = {}
info.update(user._info)