Skip to content

Commit fefc3ba

Browse files
committed
Remove deprecated services binary CLI arg
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
1 parent 01fb165 commit fefc3ba

File tree

5 files changed

+25
-47
lines changed

5 files changed

+25
-47
lines changed

novaclient/tests/functional/v2/legacy/test_os_services.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@ def test_os_service_disable_enable(self):
4141
continue
4242
host = self._get_column_value_from_single_row_table(
4343
self.nova('service-list --binary %s' % serv.binary), 'Host')
44-
service = self.nova('service-disable %s %s' % (host, serv.binary))
45-
self.addCleanup(self.nova, 'service-enable',
46-
params="%s %s" % (host, serv.binary))
44+
service = self.nova('service-disable %s' % host)
45+
self.addCleanup(self.nova, 'service-enable', params=host)
4746
status = self._get_column_value_from_single_row_table(
4847
service, 'Status')
4948
self.assertEqual('disabled', status)
50-
service = self.nova('service-enable %s %s' % (host, serv.binary))
49+
service = self.nova('service-enable %s' % host)
5150
status = self._get_column_value_from_single_row_table(
5251
service, 'Status')
5352
self.assertEqual('enabled', status)
@@ -64,10 +63,9 @@ def test_os_service_disable_log_reason(self):
6463
continue
6564
host = self._get_column_value_from_single_row_table(
6665
self.nova('service-list --binary %s' % serv.binary), 'Host')
67-
service = self.nova('service-disable --reason test_disable %s %s'
68-
% (host, serv.binary))
69-
self.addCleanup(self.nova, 'service-enable',
70-
params="%s %s" % (host, serv.binary))
66+
service = self.nova(
67+
'service-disable --reason test_disable %s' % host)
68+
self.addCleanup(self.nova, 'service-enable', params=host)
7169
status = self._get_column_value_from_single_row_table(
7270
service, 'Status')
7371
log_reason = self._get_column_value_from_single_row_table(

novaclient/tests/functional/v2/test_os_services.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,13 @@ def test_os_services_force_down_force_up(self):
3838

3939
host = self._get_column_value_from_single_row_table(service_list,
4040
'Host')
41-
service = self.nova('service-force-down %s %s'
42-
% (host, serv.binary))
41+
service = self.nova('service-force-down %s' % host)
4342
self.addCleanup(self.nova, 'service-force-down --unset',
44-
params="%s %s" % (host, serv.binary))
43+
params=host)
4544
status = self._get_column_value_from_single_row_table(
4645
service, 'Forced down')
4746
self.assertEqual('True', status)
48-
service = self.nova('service-force-down --unset %s %s'
49-
% (host, serv.binary))
47+
service = self.nova('service-force-down --unset %s' % host)
5048
status = self._get_column_value_from_single_row_table(
5149
service, 'Forced down')
5250
self.assertEqual('False', status)

novaclient/tests/unit/v2/test_shell.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,8 +2369,8 @@ def test_services_list_with_host_binary(self):
23692369
self.assert_called('GET', '/os-services?host=host1&binary=nova-cert')
23702370

23712371
def test_services_enable(self):
2372-
self.run_command('service-enable host1 nova-cert')
2373-
body = {'host': 'host1', 'binary': 'nova-cert'}
2372+
self.run_command('service-enable host1')
2373+
body = {'host': 'host1', 'binary': 'nova-compute'}
23742374
self.assert_called('PUT', '/os-services/enable', body)
23752375

23762376
def test_services_enable_v2_53(self):
@@ -2381,15 +2381,9 @@ def test_services_enable_v2_53(self):
23812381
self.assert_called(
23822382
'PUT', '/os-services/%s' % fakes.FAKE_SERVICE_UUID_1, body)
23832383

2384-
def test_services_enable_default_binary(self):
2385-
"""Tests that the default binary is nova-compute if not specified."""
2386-
self.run_command('service-enable host1')
2387-
body = {'host': 'host1', 'binary': 'nova-compute'}
2388-
self.assert_called('PUT', '/os-services/enable', body)
2389-
23902384
def test_services_disable(self):
2391-
self.run_command('service-disable host1 nova-cert')
2392-
body = {'host': 'host1', 'binary': 'nova-cert'}
2385+
self.run_command('service-disable host1')
2386+
body = {'host': 'host1', 'binary': 'nova-compute'}
23932387
self.assert_called('PUT', '/os-services/disable', body)
23942388

23952389
def test_services_disable_v2_53(self):
@@ -2400,15 +2394,9 @@ def test_services_disable_v2_53(self):
24002394
self.assert_called(
24012395
'PUT', '/os-services/%s' % fakes.FAKE_SERVICE_UUID_1, body)
24022396

2403-
def test_services_disable_default_binary(self):
2404-
"""Tests that the default binary is nova-compute if not specified."""
2405-
self.run_command('service-disable host1')
2406-
body = {'host': 'host1', 'binary': 'nova-compute'}
2407-
self.assert_called('PUT', '/os-services/disable', body)
2408-
24092397
def test_services_disable_with_reason(self):
2410-
self.run_command('service-disable host1 nova-cert --reason no_reason')
2411-
body = {'host': 'host1', 'binary': 'nova-cert',
2398+
self.run_command('service-disable host1 --reason no_reason')
2399+
body = {'host': 'host1', 'binary': 'nova-compute',
24122400
'disabled_reason': 'no_reason'}
24132401
self.assert_called('PUT', '/os-services/disable-log-reason', body)
24142402

novaclient/v2/shell.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,13 +3400,9 @@ def do_service_list(cs, args):
34003400
# values.
34013401
@api_versions.wraps('2.0', '2.52')
34023402
@utils.arg('host', metavar='<hostname>', help=_('Name of host.'))
3403-
# TODO(mriedem): Eventually just hard-code the binary to "nova-compute".
3404-
@utils.arg('binary', metavar='<binary>', help=_('Service binary. The only '
3405-
'meaningful binary is "nova-compute". (Deprecated)'),
3406-
default='nova-compute', nargs='?')
34073403
def do_service_enable(cs, args):
34083404
"""Enable the service."""
3409-
result = cs.services.enable(args.host, args.binary)
3405+
result = cs.services.enable(args.host, 'nova-compute')
34103406
utils.print_list([result], ['Host', 'Binary', 'Status'])
34113407

34123408

@@ -3423,23 +3419,19 @@ def do_service_enable(cs, args):
34233419
# values.
34243420
@api_versions.wraps('2.0', '2.52')
34253421
@utils.arg('host', metavar='<hostname>', help=_('Name of host.'))
3426-
# TODO(mriedem): Eventually just hard-code the binary to "nova-compute".
3427-
@utils.arg('binary', metavar='<binary>', help=_('Service binary. The only '
3428-
'meaningful binary is "nova-compute". (Deprecated)'),
3429-
default='nova-compute', nargs='?')
34303422
@utils.arg(
34313423
'--reason',
34323424
metavar='<reason>',
34333425
help=_('Reason for disabling service.'))
34343426
def do_service_disable(cs, args):
34353427
"""Disable the service."""
34363428
if args.reason:
3437-
result = cs.services.disable_log_reason(args.host, args.binary,
3429+
result = cs.services.disable_log_reason(args.host, 'nova-compute',
34383430
args.reason)
34393431
utils.print_list([result], ['Host', 'Binary', 'Status',
34403432
'Disabled Reason'])
34413433
else:
3442-
result = cs.services.disable(args.host, args.binary)
3434+
result = cs.services.disable(args.host, 'nova-compute')
34433435
utils.print_list([result], ['Host', 'Binary', 'Status'])
34443436

34453437

@@ -3465,10 +3457,6 @@ def do_service_disable(cs, args):
34653457
# values.
34663458
@api_versions.wraps("2.11", "2.52")
34673459
@utils.arg('host', metavar='<hostname>', help=_('Name of host.'))
3468-
# TODO(mriedem): Eventually just hard-code the binary to "nova-compute".
3469-
@utils.arg('binary', metavar='<binary>', help=_('Service binary. The only '
3470-
'meaningful binary is "nova-compute". (Deprecated)'),
3471-
default='nova-compute', nargs='?')
34723460
@utils.arg(
34733461
'--unset',
34743462
dest='force_down',
@@ -3477,7 +3465,7 @@ def do_service_disable(cs, args):
34773465
default=True)
34783466
def do_service_force_down(cs, args):
34793467
"""Force service to down."""
3480-
result = cs.services.force_down(args.host, args.binary, args.force_down)
3468+
result = cs.services.force_down(args.host, 'nova-compute', args.force_down)
34813469
utils.print_list([result], ['Host', 'Binary', 'Forced down'])
34823470

34833471

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
upgrade:
3+
- |
4+
The deprecated ``binary`` argument to the ``nova service-enable``,
5+
``nova service-disable``, and ``nova service-force-down`` commands has been
6+
removed.

0 commit comments

Comments
 (0)