add host action for updating all instances
This commit is contained in:

committed by
Tim Simpson

parent
9249ac8890
commit
ef67fe3b4d
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
from reddwarfclient import base
|
from reddwarfclient import base
|
||||||
|
|
||||||
|
from reddwarfclient.common import check_for_exceptions
|
||||||
|
|
||||||
|
|
||||||
class Host(base.Resource):
|
class Host(base.Resource):
|
||||||
"""
|
"""
|
||||||
@@ -36,6 +38,21 @@ class Hosts(base.ManagerWithFind):
|
|||||||
raise Exception("Call to " + url + " did not return a body.")
|
raise Exception("Call to " + url + " did not return a body.")
|
||||||
return [self.resource_class(self, res) for res in body[response_key]]
|
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):
|
def index(self):
|
||||||
"""
|
"""
|
||||||
Get a list of all hosts.
|
Get a list of all hosts.
|
||||||
|
Reference in New Issue
Block a user