From ef67fe3b4d1e3bbbb9adc3df8f257134bed00a18 Mon Sep 17 00:00:00 2001 From: Paul Marshall Date: Thu, 28 Jun 2012 10:59:47 -0500 Subject: [PATCH] add host action for updating all instances --- reddwarfclient/hosts.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/reddwarfclient/hosts.py b/reddwarfclient/hosts.py index 96bc621d..fb03d379 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.