summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZiad Sawalha <github@highbridgellc.com>2011-06-11 09:17:46 -0500
committerZiad Sawalha <github@highbridgellc.com>2011-06-11 09:17:46 -0500
commit38901ddcce5682d17e96764da37fab8ecfeb0c46 (patch)
tree2bbaaac3a6b2c1996576d992c84a6bb989577100
parentb272479802504797f2b986d8b25e3ecd06317292 (diff)
Update sample data and keystone-manage for local install of OpenStack
-rwxr-xr-xbin/keystone-manage59
-rwxr-xr-xbin/sampledata.sh4
2 files changed, 36 insertions, 27 deletions
diff --git a/bin/keystone-manage b/bin/keystone-manage
index 582b7bf5..df8d055b 100755
--- a/bin/keystone-manage
+++ b/bin/keystone-manage
@@ -124,9 +124,9 @@ def Main():
tenant = args[4]
object.tenant_id = tenant
db_api.user_create(object)
- print "User created successfully. ID=%s" % object.id
+ print "SUCCESS: User %s created." % object.id
except Exception as exc:
- print "ERROR: Failed to create user: %s" % exc
+ print "ERROR: Failed to create user %s: %s" % (object_id, exc)
return
elif command == "disable":
try:
@@ -135,9 +135,9 @@ def Main():
raise IndexError("User %s not found" % object_id)
object.enabled = False
db_api.user_update(object_id, object)
- print "User disabled: %s" % object.id
+ print "SUCCESS: User %s disabled." % object.id
except Exception as exc:
- print "ERROR: Failed to disable user: %s" % exc
+ print "ERROR: Failed to disable user %s: %s" % (object_id, exc)
return
elif command == "list":
try:
@@ -168,10 +168,10 @@ def Main():
object.id = object_id
object.enabled = True
db_api.tenant_create(object)
- print "Tenant created successfully. ID=%s" % object.id
+ print "SUCCESS: Tenant %s created." % object.id
return
except Exception as exc:
- print "ERROR: Failed to create tenant: %s" % exc
+ print "ERROR: Failed to create tenant %s: %s" % (object_id, exc)
return
elif command == "list":
try:
@@ -183,7 +183,7 @@ def Main():
for row in objects:
print row.id, row.enabled
except Exception, e:
- print 'Error getting all users:', str(e)
+ print 'Error getting all users: %s', str(e)
return
elif command == "disable":
try:
@@ -192,9 +192,9 @@ def Main():
raise IndexError("Tenant %s not found" % object_id)
object.enabled = False
db_api.tenant_update(object_id, object)
- print "Tenant disabled: %s" % object.id
+ print "SUCCESS: Tenant %s disabled." % object.id
except Exception as exc:
- print "ERROR: Failed to disable tenant: %s" % exc
+ print "ERROR: Failed to disable tenant %s: %s" % (object_id, exc)
return
elif object_type == "role":
if command == "add":
@@ -202,10 +202,10 @@ def Main():
object = db_models.Role()
object.id = object_id
db_api.role_create(object)
- print "Role created successfully. ID=%s" % object.id
+ print "SUCCESS: Role %s created successfully." % object.id
return
except Exception as exc:
- print "ERROR: Failed to create role: %s" % exc
+ print "ERROR: Failed to create role %s: %s" % (object_id, exc)
return
elif command == "list":
if len(args) == 3:
@@ -214,7 +214,8 @@ def Main():
objects = db_api.tenant_role_assignments_get(tenant)
if objects == None:
raise IndexError("Assignments not found")
- print 'user', 'role'
+ print 'Role assignments for tenant %s' % tenant
+ print 'User', 'Role'
print '-' * 20
for row in objects:
print row.user_id, row.role_id
@@ -228,7 +229,8 @@ def Main():
objects = db_api.role_get_all()
if objects == None:
raise IndexError("Roles not found")
- print 'role'
+ print 'All roles'
+ print 'Role'
print '-' * 20
for row in objects:
print row.id
@@ -251,15 +253,16 @@ def Main():
if tenant != None:
object.tenant_id = tenant
db_api.user_role_add(object)
- print "Successfully granted %s the %s role on %s" %\
+ print "SUCCESS: Granted %s the %s role on %s." %\
(object.user_id, object.role_id, object.tenant_id)
except Exception as exc:
- print "ERROR: Failed to grant role: %s" % exc
+ print "ERROR: Failed to grant role %s to %s on %s: %s" % (object_id, user, tenant, exc)
return
elif object_type == "baseURLs":
if command == "add":
if len(args) < 8:
- parser.error("Missing arguments: baseURLs add 'region' 'service'"\
+ parser.error("Missing arguments: baseURLs add " \
+ "'region' 'service'" \
"'publicURL' 'adminURL' 'internalURL' 'enabled'")
region = args[2]
service = args[3]
@@ -276,10 +279,12 @@ def Main():
object.internal_url = internal_url
object.enabled = enabled
object = db_api.baseurls_create(object)
- print "BaseURl created successfully. ID=%s" % object.id
+ print "SUCCESS: Created BaseURL for %s pointing to %s." % \
+ (object.service, object.public_url)
return
except Exception as exc:
- print "ERROR: Failed to create BaseURLs: %s" % exc
+ print "ERROR: Failed to create BaseURL for %s: %s" % (service,
+ exc)
return
elif command == "list":
if len(args) == 3:
@@ -288,8 +293,9 @@ def Main():
objects = db_api.baseurls_ref_get_by_tenant(tenant)
if objects == None:
raise IndexError("URLs not found")
+ print 'Endpoints (BaseURLs) for tenant %s' % tenant
print 'service', 'region', 'Public URL'
- print '-' * 20
+ print '-' * 30
for row in objects:
print row.service, row.region, row.public_url
except Exception, e:
@@ -302,6 +308,7 @@ def Main():
objects = db_api.baseurls_get_all()
if objects == None:
raise IndexError("URLs not found")
+ print 'All Endpoints (BaseURLs)'
print 'service', 'region', 'Public URL'
print '-' * 20
for row in objects:
@@ -322,7 +329,8 @@ def Main():
object.tenant_id = tenant_id
object.baseURLs_id = baseURLs_id
object = db_api.baseurls_ref_add(object)
- print "BaseURl Ref created successfully. ID=%s" % object.id
+ print "SUCCESS: BaseURL %s added to tenant %s." % \
+ (baseURLs_id, tenant_id)
return
except Exception as exc:
print "ERROR: Failed to create BaseURL Ref: %s" % exc
@@ -342,10 +350,10 @@ def Main():
"%Y%m%dT%H:%M")
object.expires = tuple_time
db_api.token_create(object)
- print "Token created successfully. ID=%s" % object.token_id
+ print "SUCCESS: Token %s created." % object.token_id
return
except Exception as exc:
- print "ERROR: Failed to create token: %s" % exc
+ print "ERROR: Failed to create token %s: %s" % (object_id, exc)
return
elif command == "list":
try:
@@ -366,13 +374,14 @@ def Main():
raise IndexError("Token %s not found" % object_id)
else:
db_api.token_delete(object_id)
- print 'Token %s deleted' % object_id
+ print 'SUCCESS: Token %s deleted.' % object_id
except Exception, e:
- print 'Error deleting token %s:' % object_id, str(e)
+ print 'ERROR: Failed to delete token %s: %s' % \
+ object_id, str(e)
return
# Command not handled
- print ("Fail: %s %s not yet supported" % (object_type, command))
+ print ("ERROR: %s %s not yet supported" % (object_type, command))
if __name__ == '__main__':
diff --git a/bin/sampledata.sh b/bin/sampledata.sh
index 72117827..1c58ae47 100755
--- a/bin/sampledata.sh
+++ b/bin/sampledata.sh
@@ -38,9 +38,9 @@
./keystone-manage $* role grant Admin joeadmin ANOTHER:TENANT
#BaseURLs
-./keystone-manage $* baseURLs add DFW cloudFiles public.cloudfiles.com admin.cloudfiles.com internal.cloudfiles.com 1
+./keystone-manage $* baseURLs add DFW cloudFiles http://localhost:8888/v1/%tenant_id% admin.cloudfiles.com internal.cloudfiles.com 1
./keystone-manage $* baseURLs add DFW cloudFilesCDN https://storage.clouddrive.com/v1/%tenant_id% https://storage.clouddrive.com/v1/%tenant_id% https://storage.clouddrive.com/v1/%tenant_id% 1
-./keystone-manage $* baseURLs add DFW cloudServers https://servers2.api.rackspacecloud.com/v1.0/%tenant_id% https://servers.api.rackspacecloud.com/v1.0/%tenant_id% https://servers.api.rackspacecloud.com/v1.0/%tenant_id% 1
+./keystone-manage $* baseURLs add DFW cloudServers http://localhost:8008/v1.0/%tenant_id% https://servers.api.rackspacecloud.com/v1.0/%tenant_id% https://servers.api.rackspacecloud.com/v1.0/%tenant_id% 1
# Groups
#./keystone-manage $* group add Admin 1234