diff options
author | Matt Riedemann <mriedem.os@gmail.com> | 2018-01-11 17:39:50 -0500 |
---|---|---|
committer | Matt Riedemann <mriedem.os@gmail.com> | 2018-01-11 21:17:04 -0500 |
commit | fefc3ba723865307f4cc2ca287eb59faa4e8a5b1 (patch) | |
tree | 8bcc1aa0184637abdafe5209427cdb6bdee3d0ba | |
parent | 01fb16533bf562f39fe822bc12b9cc34b8580359 (diff) | |
download | python-novaclient-fefc3ba723865307f4cc2ca287eb59faa4e8a5b1.tar.gz |
Remove deprecated services binary CLI arg10.0.0
The services CLI 'binary' arg was deprecated in Pike
via change Idd0d2be960ca0ed59097c10c931da47a1a3e66fb
because with cells v2 support in the API, the binary
argument for the enable/disable CLIs doesn't make sense
as the only binary those work with is 'nova-compute'.
So this removes the deprecated argument and hard-codes
the value to be 'nova-compute'.
Change-Id: I60490f3d74212bb172dccc1c7d337198e1021236
-rw-r--r-- | novaclient/tests/functional/v2/legacy/test_os_services.py | 14 | ||||
-rw-r--r-- | novaclient/tests/functional/v2/test_os_services.py | 8 | ||||
-rw-r--r-- | novaclient/tests/unit/v2/test_shell.py | 24 | ||||
-rw-r--r-- | novaclient/v2/shell.py | 20 | ||||
-rw-r--r-- | releasenotes/notes/remove-service-binary-arg-ec2838214c8c7abc.yaml | 6 |
5 files changed, 25 insertions, 47 deletions
diff --git a/novaclient/tests/functional/v2/legacy/test_os_services.py b/novaclient/tests/functional/v2/legacy/test_os_services.py index 8af71611..6a12de2c 100644 --- a/novaclient/tests/functional/v2/legacy/test_os_services.py +++ b/novaclient/tests/functional/v2/legacy/test_os_services.py @@ -41,13 +41,12 @@ class TestOsServicesNovaClient(base.ClientTestBase): continue host = self._get_column_value_from_single_row_table( self.nova('service-list --binary %s' % serv.binary), 'Host') - service = self.nova('service-disable %s %s' % (host, serv.binary)) - self.addCleanup(self.nova, 'service-enable', - params="%s %s" % (host, serv.binary)) + service = self.nova('service-disable %s' % host) + self.addCleanup(self.nova, 'service-enable', params=host) status = self._get_column_value_from_single_row_table( service, 'Status') self.assertEqual('disabled', status) - service = self.nova('service-enable %s %s' % (host, serv.binary)) + service = self.nova('service-enable %s' % host) status = self._get_column_value_from_single_row_table( service, 'Status') self.assertEqual('enabled', status) @@ -64,10 +63,9 @@ class TestOsServicesNovaClient(base.ClientTestBase): continue host = self._get_column_value_from_single_row_table( self.nova('service-list --binary %s' % serv.binary), 'Host') - service = self.nova('service-disable --reason test_disable %s %s' - % (host, serv.binary)) - self.addCleanup(self.nova, 'service-enable', - params="%s %s" % (host, serv.binary)) + service = self.nova( + 'service-disable --reason test_disable %s' % host) + self.addCleanup(self.nova, 'service-enable', params=host) status = self._get_column_value_from_single_row_table( service, 'Status') log_reason = self._get_column_value_from_single_row_table( diff --git a/novaclient/tests/functional/v2/test_os_services.py b/novaclient/tests/functional/v2/test_os_services.py index 1dba1ad0..40da9f74 100644 --- a/novaclient/tests/functional/v2/test_os_services.py +++ b/novaclient/tests/functional/v2/test_os_services.py @@ -38,15 +38,13 @@ class TestOsServicesNovaClientV211(test_os_services.TestOsServicesNovaClient): host = self._get_column_value_from_single_row_table(service_list, 'Host') - service = self.nova('service-force-down %s %s' - % (host, serv.binary)) + service = self.nova('service-force-down %s' % host) self.addCleanup(self.nova, 'service-force-down --unset', - params="%s %s" % (host, serv.binary)) + params=host) status = self._get_column_value_from_single_row_table( service, 'Forced down') self.assertEqual('True', status) - service = self.nova('service-force-down --unset %s %s' - % (host, serv.binary)) + service = self.nova('service-force-down --unset %s' % host) status = self._get_column_value_from_single_row_table( service, 'Forced down') self.assertEqual('False', status) diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py index 6174feff..5163959a 100644 --- a/novaclient/tests/unit/v2/test_shell.py +++ b/novaclient/tests/unit/v2/test_shell.py @@ -2369,8 +2369,8 @@ class ShellTest(utils.TestCase): self.assert_called('GET', '/os-services?host=host1&binary=nova-cert') def test_services_enable(self): - self.run_command('service-enable host1 nova-cert') - body = {'host': 'host1', 'binary': 'nova-cert'} + self.run_command('service-enable host1') + body = {'host': 'host1', 'binary': 'nova-compute'} self.assert_called('PUT', '/os-services/enable', body) def test_services_enable_v2_53(self): @@ -2381,15 +2381,9 @@ class ShellTest(utils.TestCase): self.assert_called( 'PUT', '/os-services/%s' % fakes.FAKE_SERVICE_UUID_1, body) - def test_services_enable_default_binary(self): - """Tests that the default binary is nova-compute if not specified.""" - self.run_command('service-enable host1') - body = {'host': 'host1', 'binary': 'nova-compute'} - self.assert_called('PUT', '/os-services/enable', body) - def test_services_disable(self): - self.run_command('service-disable host1 nova-cert') - body = {'host': 'host1', 'binary': 'nova-cert'} + self.run_command('service-disable host1') + body = {'host': 'host1', 'binary': 'nova-compute'} self.assert_called('PUT', '/os-services/disable', body) def test_services_disable_v2_53(self): @@ -2400,15 +2394,9 @@ class ShellTest(utils.TestCase): self.assert_called( 'PUT', '/os-services/%s' % fakes.FAKE_SERVICE_UUID_1, body) - def test_services_disable_default_binary(self): - """Tests that the default binary is nova-compute if not specified.""" - self.run_command('service-disable host1') - body = {'host': 'host1', 'binary': 'nova-compute'} - self.assert_called('PUT', '/os-services/disable', body) - def test_services_disable_with_reason(self): - self.run_command('service-disable host1 nova-cert --reason no_reason') - body = {'host': 'host1', 'binary': 'nova-cert', + self.run_command('service-disable host1 --reason no_reason') + body = {'host': 'host1', 'binary': 'nova-compute', 'disabled_reason': 'no_reason'} self.assert_called('PUT', '/os-services/disable-log-reason', body) diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index 684f8cf2..8ad018c4 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -3400,13 +3400,9 @@ def do_service_list(cs, args): # values. @api_versions.wraps('2.0', '2.52') @utils.arg('host', metavar='<hostname>', help=_('Name of host.')) -# TODO(mriedem): Eventually just hard-code the binary to "nova-compute". -@utils.arg('binary', metavar='<binary>', help=_('Service binary. The only ' - 'meaningful binary is "nova-compute". (Deprecated)'), - default='nova-compute', nargs='?') def do_service_enable(cs, args): """Enable the service.""" - result = cs.services.enable(args.host, args.binary) + result = cs.services.enable(args.host, 'nova-compute') utils.print_list([result], ['Host', 'Binary', 'Status']) @@ -3423,10 +3419,6 @@ def do_service_enable(cs, args): # values. @api_versions.wraps('2.0', '2.52') @utils.arg('host', metavar='<hostname>', help=_('Name of host.')) -# TODO(mriedem): Eventually just hard-code the binary to "nova-compute". -@utils.arg('binary', metavar='<binary>', help=_('Service binary. The only ' - 'meaningful binary is "nova-compute". (Deprecated)'), - default='nova-compute', nargs='?') @utils.arg( '--reason', metavar='<reason>', @@ -3434,12 +3426,12 @@ def do_service_enable(cs, args): def do_service_disable(cs, args): """Disable the service.""" if args.reason: - result = cs.services.disable_log_reason(args.host, args.binary, + result = cs.services.disable_log_reason(args.host, 'nova-compute', args.reason) utils.print_list([result], ['Host', 'Binary', 'Status', 'Disabled Reason']) else: - result = cs.services.disable(args.host, args.binary) + result = cs.services.disable(args.host, 'nova-compute') utils.print_list([result], ['Host', 'Binary', 'Status']) @@ -3465,10 +3457,6 @@ def do_service_disable(cs, args): # values. @api_versions.wraps("2.11", "2.52") @utils.arg('host', metavar='<hostname>', help=_('Name of host.')) -# TODO(mriedem): Eventually just hard-code the binary to "nova-compute". -@utils.arg('binary', metavar='<binary>', help=_('Service binary. The only ' - 'meaningful binary is "nova-compute". (Deprecated)'), - default='nova-compute', nargs='?') @utils.arg( '--unset', dest='force_down', @@ -3477,7 +3465,7 @@ def do_service_disable(cs, args): default=True) def do_service_force_down(cs, args): """Force service to down.""" - result = cs.services.force_down(args.host, args.binary, args.force_down) + result = cs.services.force_down(args.host, 'nova-compute', args.force_down) utils.print_list([result], ['Host', 'Binary', 'Forced down']) diff --git a/releasenotes/notes/remove-service-binary-arg-ec2838214c8c7abc.yaml b/releasenotes/notes/remove-service-binary-arg-ec2838214c8c7abc.yaml new file mode 100644 index 00000000..2a136a23 --- /dev/null +++ b/releasenotes/notes/remove-service-binary-arg-ec2838214c8c7abc.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The deprecated ``binary`` argument to the ``nova service-enable``, + ``nova service-disable``, and ``nova service-force-down`` commands has been + removed. |