Rewrite link parsing for finding v2 schemas

What we called 'links' are no longer returned in a container of
objects, they are top-level entity attribtues. This fixes the
parsing of the entities to look in the correct place when trying
to locate a specific schema.

Add a helper for printing to stderr and exiting with a non-zero
exit code.

Map 'name' to 'Attribute' when explaining a schema.

Related to bp glance-client-v2

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a05
This commit is contained in:
Brian Waldon
2012-07-13 22:03:22 +00:00
parent 53acf1a0ca
commit f0445a1b44
4 changed files with 26 additions and 13 deletions
+8 -1
View File
@@ -14,6 +14,7 @@
# under the License.
import os
import sys
import uuid
import prettytable
@@ -47,7 +48,7 @@ def print_list(objs, fields, formatters={}):
row.append(formatters[field](o))
else:
field_name = field.lower().replace(' ', '_')
data = getattr(o, field_name, '')
data = getattr(o, field_name, None) or ''
row.append(data)
pt.add_row(row)
@@ -123,3 +124,9 @@ def import_versioned_module(version, submodule=None):
if submodule:
module = '.'.join((module, submodule))
return importutils.import_module(module)
def exit(msg=''):
if msg:
print >> sys.stderr, msg
sys.exit(1)