git://git.onelab.eu
/
plstackapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5d0ce61
)
give admin user the admin role to every tenant created by OpenStackDriver
author
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Mon, 29 Apr 2013 23:41:39 +0000
(19:41 -0400)
committer
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Mon, 29 Apr 2013 23:41:39 +0000
(19:41 -0400)
plstackapi/openstack/driver.py
patch
|
blob
|
history
diff --git
a/plstackapi/openstack/driver.py
b/plstackapi/openstack/driver.py
index
50d52f7
..
a1a3333
100644
(file)
--- a/
plstackapi/openstack/driver.py
+++ b/
plstackapi/openstack/driver.py
@@
-9,6
+9,9
@@
class OpenStackDriver:
else:
self.config = Config()
+ self.admin_client = OpenStackClient()
+ self.admin_user = self.admin_client.keystone.users.find(name=self.admin_client.keystone.username)
+
if client:
self.shell = client
else:
@@
-37,6
+40,10
@@
class OpenStackDriver:
tenant = self.shell.keystone.tenants.create(**fields)
else:
tenant = tenants[0]
+
+ # always give the admin user the admin role to any tenant created
+ # by the driver.
+ self.add_user_role(self.admin_user.id, tenant.id, 'admin')
return tenant
def update_tenant(self, id, **kwds):