Rename nodes/<uuid>/state to nodes/<uuid>/states
The commit https://review.openstack.org/#/c/60299 refactored the /state subresource of nodes in the Ironic API and one of the changes made was to rename the subresource from /state to /states (plural) since now both power and provision state can be retrieved in one request call. Change-Id: I3e3cf29fa0fd48063ae0ca14eac6f685ccc44e65
This commit is contained in:
parent
66375e50ce
commit
e9a44653d8
ironicclient
@ -45,8 +45,8 @@ PORT = {'id': 456,
|
||||
'address': 'AA:AA:AA:AA:AA:AA',
|
||||
'extra': {}}
|
||||
|
||||
POWER_STATE = {'current': 'power off',
|
||||
'target': 'power on'}
|
||||
POWER_STATE = {'power_state': 'power off',
|
||||
'target_power_state': 'power on'}
|
||||
|
||||
DRIVER_IFACES = {'power': True, 'deploy': True,
|
||||
'console': 'not supported',
|
||||
@ -122,7 +122,7 @@ fake_responses = {
|
||||
{"ports": [PORT]},
|
||||
),
|
||||
},
|
||||
'/v1/nodes/%s/state/power' % NODE1['uuid']:
|
||||
'/v1/nodes/%s/states/power' % NODE1['uuid']:
|
||||
{
|
||||
'PUT': (
|
||||
{},
|
||||
@ -231,10 +231,10 @@ class NodeManagerTest(testtools.TestCase):
|
||||
power_state = self.mgr.set_power_state(NODE1['uuid'], "on")
|
||||
body = {'target': 'power on'}
|
||||
expect = [
|
||||
('PUT', '/v1/nodes/%s/state/power' % NODE1['uuid'], {}, body),
|
||||
('PUT', '/v1/nodes/%s/states/power' % NODE1['uuid'], {}, body),
|
||||
]
|
||||
self.assertEqual(expect, self.api.calls)
|
||||
self.assertEqual('power on', power_state.target)
|
||||
self.assertEqual('power on', power_state.target_power_state)
|
||||
|
||||
def test_node_validate(self):
|
||||
ifaces = self.mgr.validate(NODE1['uuid'])
|
||||
|
@ -78,7 +78,7 @@ class NodeManager(base.Manager):
|
||||
return self._update(self._path(node_id), patch)
|
||||
|
||||
def set_power_state(self, node_id, state):
|
||||
path = "%s/state/power" % node_id
|
||||
path = "%s/states/power" % node_id
|
||||
if state in ['on', 'off']:
|
||||
state = "power %s" % state
|
||||
if state in ['reboot']:
|
||||
|
Loading…
x
Reference in New Issue
Block a user