summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZiad Sawalha <github@highbridgellc.com>2011-06-03 01:10:48 -0500
committerZiad Sawalha <github@highbridgellc.com>2011-06-03 01:10:48 -0500
commitf50d0e8a2c8c32a92f29029389dae347c358b8be (patch)
tree825907a40e21efd24905afc5ee80ee9bb4d49f28
parentc40b96a7aea557cf0d62ef133a383343fcc8a07d (diff)
Support for listing BaseURL refs in keystone-manage
-rwxr-xr-xbin/keystone-manage28
-rw-r--r--keystone/db/sqlalchemy/api.py6
2 files changed, 34 insertions, 0 deletions
diff --git a/bin/keystone-manage b/bin/keystone-manage
index 6ad73e96..496d5337 100755
--- a/bin/keystone-manage
+++ b/bin/keystone-manage
@@ -281,6 +281,34 @@ def Main():
except Exception as exc:
print "ERROR: Failed to create BaseURLs: %s" % exc
return
+ elif command == "list":
+ if len(args) == 3:
+ tenant = args[2]
+ try:
+ objects = db_api.baseurls_ref_get_by_tenant(tenant)
+ if objects == None:
+ raise IndexError("URLs not found")
+ print 'service', 'region', 'Public URL'
+ print '-' * 20
+ for row in objects:
+ print row.service, row.region, row.public_url
+ except Exception, e:
+ print 'Error getting all URL refs for %s:' % \
+ tenant, str(e)
+ return
+ else:
+ tenant = None
+ try:
+ objects = db_api.baseurls_get_all()
+ if objects == None:
+ raise IndexError("URLs not found")
+ print 'service', 'region', 'Public URL'
+ print '-' * 20
+ for row in objects:
+ print row.service, row.region, row.public_url
+ except Exception, e:
+ print 'Error getting all BaseURLs:', str(e)
+ return
elif object_type == "token":
if command == "add":
if len(args) < 6:
diff --git a/keystone/db/sqlalchemy/api.py b/keystone/db/sqlalchemy/api.py
index 6c3c0799..b8728077 100644
--- a/keystone/db/sqlalchemy/api.py
+++ b/keystone/db/sqlalchemy/api.py
@@ -1161,6 +1161,12 @@ def baseurls_ref_get(id, session=None):
result = session.query(models.TenantBaseURLAssociation).filter_by(id=id).first()
return result
+def baseurls_ref_get_by_tenant(tenant_id, session=None):
+ if not session:
+ session = get_session()
+ result = session.query(models.TenantBaseURLAssociation).filter_by(tenant_id=tenant_id).first()
+ return result
+
def baseurls_ref_delete(id, session=None):
if not session:
session = get_session()