Merge remote branch 'SandyWalsh/master'
This commit is contained in:
commit
27709a3e24
@ -109,7 +109,8 @@ class Resource(object):
|
||||
|
||||
def get(self):
|
||||
new = self.manager.get(self.id)
|
||||
self._add_details(new._info)
|
||||
if new:
|
||||
self._add_details(new._info)
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, self.__class__):
|
||||
|
@ -492,13 +492,13 @@ class OpenStackShell(object):
|
||||
self._find_server(args.server).delete()
|
||||
|
||||
# --zone_username is required since --username is already used.
|
||||
@arg('zone', metavar='<zone>', help='Name or ID of the zone')
|
||||
@arg('zone', metavar='<zone_id>', help='ID of the zone', default=None)
|
||||
@arg('--api_url', dest='api_url', default=None, help='New URL.')
|
||||
@arg('--zone_username', dest='zone_username', default=None,
|
||||
help='New zone username.')
|
||||
@arg('--password', dest='password', default=None, help='New password.')
|
||||
def do_zone(self, args):
|
||||
"""Show or edit a zone."""
|
||||
"""Show or edit a child zone. No zone arg for this zone."""
|
||||
zone = self.cs.zones.get(args.zone)
|
||||
|
||||
# If we have some flags, update the zone
|
||||
@ -514,6 +514,11 @@ class OpenStackShell(object):
|
||||
else:
|
||||
print_dict(zone._info)
|
||||
|
||||
def do_zone_info(self, args):
|
||||
"""Get this zones name and capabilities."""
|
||||
zone = self.cs.zones.info()
|
||||
print_dict(zone._info)
|
||||
|
||||
@arg('api_url', metavar='<api_url>', help="URL for the Zone's API")
|
||||
@arg('zone_username', metavar='<zone_username>',
|
||||
help='Authentication username.')
|
||||
@ -531,7 +536,8 @@ class OpenStackShell(object):
|
||||
|
||||
def do_zone_list(self, args):
|
||||
"""List the children of a zone."""
|
||||
print_list(self.cs.zones.list(), ['ID', 'API URL'])
|
||||
print_list(self.cs.zones.list(), ['ID', 'Name', 'Is Active',
|
||||
'Capabilities', 'API URL'])
|
||||
|
||||
def _find_server(self, server):
|
||||
"""Get a server by name or ID."""
|
||||
|
@ -2,6 +2,12 @@ from novatools import base
|
||||
|
||||
|
||||
class Zone(base.Resource):
|
||||
def __init__(self, manager, info):
|
||||
self.name = "n/a"
|
||||
self.is_active = "n/a"
|
||||
self.capabilities = "n/a"
|
||||
super(Zone, self).__init__(manager, info)
|
||||
|
||||
def __repr__(self):
|
||||
return "<Zone: %s>" % self.api_url
|
||||
|
||||
@ -25,6 +31,14 @@ class Zone(base.Resource):
|
||||
class ZoneManager(base.ManagerWithFind):
|
||||
resource_class = Zone
|
||||
|
||||
def info(self):
|
||||
"""
|
||||
Get info on this zone.
|
||||
|
||||
:rtype: :class:`Zone`
|
||||
"""
|
||||
return self._get("/zones/info", "zone")
|
||||
|
||||
def get(self, zone):
|
||||
"""
|
||||
Get a child zone.
|
||||
|
Loading…
Reference in New Issue
Block a user