Merge remote branch 'SandyWalsh/master'
This commit is contained in:
commit
27709a3e24
@ -109,6 +109,7 @@ class Resource(object):
|
|||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
new = self.manager.get(self.id)
|
new = self.manager.get(self.id)
|
||||||
|
if new:
|
||||||
self._add_details(new._info)
|
self._add_details(new._info)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
|
@ -492,13 +492,13 @@ class OpenStackShell(object):
|
|||||||
self._find_server(args.server).delete()
|
self._find_server(args.server).delete()
|
||||||
|
|
||||||
# --zone_username is required since --username is already used.
|
# --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('--api_url', dest='api_url', default=None, help='New URL.')
|
||||||
@arg('--zone_username', dest='zone_username', default=None,
|
@arg('--zone_username', dest='zone_username', default=None,
|
||||||
help='New zone username.')
|
help='New zone username.')
|
||||||
@arg('--password', dest='password', default=None, help='New password.')
|
@arg('--password', dest='password', default=None, help='New password.')
|
||||||
def do_zone(self, args):
|
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)
|
zone = self.cs.zones.get(args.zone)
|
||||||
|
|
||||||
# If we have some flags, update the zone
|
# If we have some flags, update the zone
|
||||||
@ -514,6 +514,11 @@ class OpenStackShell(object):
|
|||||||
else:
|
else:
|
||||||
print_dict(zone._info)
|
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('api_url', metavar='<api_url>', help="URL for the Zone's API")
|
||||||
@arg('zone_username', metavar='<zone_username>',
|
@arg('zone_username', metavar='<zone_username>',
|
||||||
help='Authentication username.')
|
help='Authentication username.')
|
||||||
@ -531,7 +536,8 @@ class OpenStackShell(object):
|
|||||||
|
|
||||||
def do_zone_list(self, args):
|
def do_zone_list(self, args):
|
||||||
"""List the children of a zone."""
|
"""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):
|
def _find_server(self, server):
|
||||||
"""Get a server by name or ID."""
|
"""Get a server by name or ID."""
|
||||||
|
@ -2,6 +2,12 @@ from novatools import base
|
|||||||
|
|
||||||
|
|
||||||
class Zone(base.Resource):
|
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):
|
def __repr__(self):
|
||||||
return "<Zone: %s>" % self.api_url
|
return "<Zone: %s>" % self.api_url
|
||||||
|
|
||||||
@ -25,6 +31,14 @@ class Zone(base.Resource):
|
|||||||
class ZoneManager(base.ManagerWithFind):
|
class ZoneManager(base.ManagerWithFind):
|
||||||
resource_class = Zone
|
resource_class = Zone
|
||||||
|
|
||||||
|
def info(self):
|
||||||
|
"""
|
||||||
|
Get info on this zone.
|
||||||
|
|
||||||
|
:rtype: :class:`Zone`
|
||||||
|
"""
|
||||||
|
return self._get("/zones/info", "zone")
|
||||||
|
|
||||||
def get(self, zone):
|
def get(self, zone):
|
||||||
"""
|
"""
|
||||||
Get a child zone.
|
Get a child zone.
|
||||||
|
2
setup.py
2
setup.py
@ -11,7 +11,7 @@ if sys.version_info < (2,6):
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = "python-novatools",
|
name = "python-novatools",
|
||||||
version = "1.2",
|
version = "2.0",
|
||||||
description = "Client library for OpenStack Nova API",
|
description = "Client library for OpenStack Nova API",
|
||||||
long_description = read('README.rst'),
|
long_description = read('README.rst'),
|
||||||
url = 'https://github.com/rackspace/python-novatools',
|
url = 'https://github.com/rackspace/python-novatools',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user