diff options
| author | Paul Marshall <paul.marshall@colorado.edu> | 2012-06-28 10:59:47 -0500 |
|---|---|---|
| committer | Tim Simpson <tim.simpson@rackspace.com> | 2012-08-21 13:54:48 -0500 |
| commit | ef67fe3b4d1e3bbbb9adc3df8f257134bed00a18 (patch) | |
| tree | 9d2ca38735619d6df985e18acf20b90f632d584d | |
| parent | 9249ac8890eb4c1eb17315693ae7249d5f09fb05 (diff) | |
| download | python-troveclient-ef67fe3b4d1e3bbbb9adc3df8f257134bed00a18.tar.gz | |
add host action for updating all instances
| -rw-r--r-- | reddwarfclient/hosts.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/reddwarfclient/hosts.py b/reddwarfclient/hosts.py index 96bc621..fb03d37 100644 --- a/reddwarfclient/hosts.py +++ b/reddwarfclient/hosts.py @@ -15,6 +15,8 @@ from reddwarfclient import base +from reddwarfclient.common import check_for_exceptions + class Host(base.Resource): """ @@ -36,6 +38,21 @@ class Hosts(base.ManagerWithFind): raise Exception("Call to " + url + " did not return a body.") return [self.resource_class(self, res) for res in body[response_key]] + def _action(self, host_id, body): + """ + Perform a host "action" -- update + """ + url = "/mgmt/hosts/%s/instances/action" % host_id + resp, body = self.api.client.post(url, body=body) + check_for_exceptions(resp, body) + + def update_all(self, host_id): + """ + Update all instances on a host. + """ + body = {'update': ''} + self._action(host_id, body) + def index(self): """ Get a list of all hosts. |
