Permalink
Browse files

Revert API changes in "Unify Manager._update behaviour"

This revert some of commit 6307310,
specifically the changes made to the API since those changes were
never merged in Nova.

Resolves bug 1145768.

Change-Id: I8f83c5a33cfed0c3a659f5221b8b2e730ca9463f
  • Loading branch information...
1 parent f73df49 commit 65b55d8f9b4ff7ccbd137e94087949a8c92c1de2 @hanlind hanlind committed Mar 7, 2013
Showing with 19 additions and 19 deletions.
  1. +1 −1 novaclient/v1_1/hosts.py
  2. +12 −12 tests/v1_1/fakes.py
  3. +3 −3 tests/v1_1/test_hosts.py
  4. +3 −3 tests/v1_1/test_shell.py
View
@@ -54,7 +54,7 @@ def get(self, host):
def update(self, host, values):
"""Update status or maintenance mode for the host."""
- return self._update("/os-hosts/%s" % host, {"host": values}, "host")
+ return self._update("/os-hosts/%s" % host, values)
def host_action(self, host, action):
"""Performs an action on a host."""
View
@@ -1357,36 +1357,36 @@ def get_os_hosts_host(self, *kw):
def get_os_hosts(self, **kw):
zone = kw.get('zone', 'nova1')
return (200, {}, {'hosts':
- [{'host_name': 'host1',
+ [{'host': 'host1',
'service': 'nova-compute',
'zone': zone},
- {'host_name': 'host1',
+ {'host': 'host1',
'service': 'nova-cert',
'zone': zone}]})
def get_os_hosts_sample_host(self, *kw):
return (200, {}, {'host': [{'resource': {'host': 'sample_host'}}], })
def put_os_hosts_sample_host_1(self, body, **kw):
- return (200, {}, {'host': {'host_name': 'sample-host_1',
- 'status': 'enabled'}})
+ return (200, {}, {'host': 'sample-host_1',
+ 'status': 'enabled'})
def put_os_hosts_sample_host_2(self, body, **kw):
- return (200, {}, {'host': {'host_name': 'sample-host_2',
- 'maintenance_mode': 'on_maintenance'}})
+ return (200, {}, {'host': 'sample-host_2',
+ 'maintenance_mode': 'on_maintenance'})
def put_os_hosts_sample_host_3(self, body, **kw):
- return (200, {}, {'host': {'host_name': 'sample-host_3',
- 'status': 'enabled',
- 'maintenance_mode': 'on_maintenance'}})
+ return (200, {}, {'host': 'sample-host_3',
+ 'status': 'enabled',
+ 'maintenance_mode': 'on_maintenance'})
def post_os_hosts_sample_host_action(self, **kw):
return (202, {}, None)
def put_os_hosts_sample_host(self, body, **kw):
- result = {'host_name': 'dummy'}
- result.update(body['host'])
- return (200, {}, {'host': result})
+ result = {'host': 'dummy'}
+ result.update(body)
+ return (200, {}, result)
def get_os_hypervisors(self, **kw):
return (200, {}, {"hypervisors": [
View
@@ -29,22 +29,22 @@ def test_update_enable(self):
host = cs.hosts.get('sample_host')[0]
values = {"status": "enabled"}
result = host.update(values)
- cs.assert_called('PUT', '/os-hosts/sample_host', {'host': values})
+ cs.assert_called('PUT', '/os-hosts/sample_host', values)
self.assertTrue(isinstance(result, hosts.Host))
def test_update_maintenance(self):
host = cs.hosts.get('sample_host')[0]
values = {"maintenance_mode": "enable"}
result = host.update(values)
- cs.assert_called('PUT', '/os-hosts/sample_host', {'host': values})
+ cs.assert_called('PUT', '/os-hosts/sample_host', values)
self.assertTrue(isinstance(result, hosts.Host))
def test_update_both(self):
host = cs.hosts.get('sample_host')[0]
values = {"status": "enabled",
"maintenance_mode": "enable"}
result = host.update(values)
- cs.assert_called('PUT', '/os-hosts/sample_host', {'host': values})
+ cs.assert_called('PUT', '/os-hosts/sample_host', values)
self.assertTrue(isinstance(result, hosts.Host))
def test_host_startup(self):
View
@@ -814,18 +814,18 @@ def test_host_list_with_zone(self):
def test_host_update_status(self):
self.run_command('host-update sample-host_1 --status enabled')
- body = {'host': {'status': 'enabled'}}
+ body = {'status': 'enabled'}
self.assert_called('PUT', '/os-hosts/sample-host_1', body)
def test_host_update_maintenance(self):
self.run_command('host-update sample-host_2 --maintenance enable')
- body = {'host': {'maintenance_mode': 'enable'}}
+ body = {'maintenance_mode': 'enable'}
self.assert_called('PUT', '/os-hosts/sample-host_2', body)
def test_host_update_multiple_settings(self):
self.run_command('host-update sample-host_3 '
'--status disabled --maintenance enable')
- body = {'host': {'status': 'disabled', 'maintenance_mode': 'enable'}}
+ body = {'status': 'disabled', 'maintenance_mode': 'enable'}
self.assert_called('PUT', '/os-hosts/sample-host_3', body)
def test_host_startup(self):

0 comments on commit 65b55d8

Please sign in to comment.