zone select support and version bump to 2.4.3

This commit is contained in:
Sandy Walsh 2011-05-27 07:39:22 -07:00
parent 2ec3c3febd
commit 6cb04897af
5 changed files with 16 additions and 9 deletions

View File

@ -47,7 +47,7 @@ copyright = u'Rackspace, based on work by Jacob Kaplan-Moss'
# The short X.Y version.
version = '2.4'
# The full version, including alpha/beta/rc tags.
release = '2.4.2'
release = '2.4.3'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -2,6 +2,11 @@
Release notes
=============
2.4.3 (May 27, 2011)
=================
* added support for POST /zones/select (client only, not cmdline)
2.4 (March 7, 2011)
=================

View File

@ -39,8 +39,12 @@ class Manager(object):
def __init__(self, api):
self.api = api
def _list(self, url, response_key, obj_class=None):
resp, body = self.api.client.get(url)
def _list(self, url, response_key, obj_class=None, body=None):
resp = None
if body:
resp, body = self.api.client.post(url, body=body)
else:
resp, body = self.api.client.get(url)
if obj_class is None:
obj_class = self.resource_class

View File

@ -108,12 +108,10 @@ class ZoneManager(base.ManagerWithFind):
Given requirements for a new instance, select hosts
in this zone that best match those requirements.
"""
# 'specs' may be passed in as None, so change to an empty dict.
specs = kwargs.get("specs", "")
# 'specs' may be passed in as None, so change to an empty string.
specs = kwargs.get("specs") or ""
url = "/zones/select"
if specs:
url = "%s?%s" % (url, specs)
weighting_list = self._list(url, "weights", Weighting)
weighting_list = self._list(url, "weights", Weighting, body=specs)
return [wt.to_dict() for wt in weighting_list]
def delete(self, zone):

View File

@ -11,7 +11,7 @@ if sys.version_info < (2,6):
setup(
name = "python-novaclient",
version = "2.4.2",
version = "2.4.3",
description = "Client library for OpenStack Nova API",
long_description = read('README.rst'),
url = 'https://github.com/rackspace/python-novaclient',