Merge "Add service-delete subcommand to delete a service"
This commit is contained in:
commit
5864e52d37
@ -1446,6 +1446,9 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
'status': 'disabled',
|
||||
'disabled_reason': body['disabled_reason']}})
|
||||
|
||||
def delete_os_services_1(self, **kw):
|
||||
return (204, {}, None)
|
||||
|
||||
#
|
||||
# Fixed IPs
|
||||
#
|
||||
|
@ -78,6 +78,10 @@ class ServicesTest(utils.TestCase):
|
||||
self.assertIsInstance(service, self._get_service_type())
|
||||
self.assertEqual(service.status, 'enabled')
|
||||
|
||||
def test_services_delete(self):
|
||||
service = self.cs.services.delete('1')
|
||||
self.cs.assert_called('DELETE', '/os-services/1')
|
||||
|
||||
def test_services_disable(self):
|
||||
service = self.cs.services.disable('host1', 'nova-cert')
|
||||
values = self._update_body("host1", "nova-cert")
|
||||
|
@ -1290,6 +1290,10 @@ class ShellTest(utils.TestCase):
|
||||
'disabled_reason': 'no_reason'}
|
||||
self.assert_called('PUT', '/os-services/disable-log-reason', body)
|
||||
|
||||
def test_services_delete(self):
|
||||
self.run_command('service-delete 1')
|
||||
self.assert_called('DELETE', '/os-services/1')
|
||||
|
||||
def test_fixed_ips_get(self):
|
||||
self.run_command('fixed-ip-get 192.168.1.1')
|
||||
self.assert_called('GET', '/os-fixed-ips/192.168.1.1')
|
||||
|
@ -69,3 +69,7 @@ class ServiceManager(base.ManagerWithFind):
|
||||
"""Disable the service with reason."""
|
||||
body = self._update_body(host, binary, reason)
|
||||
return self._update("/os-services/disable-log-reason", body, "service")
|
||||
|
||||
def delete(self, service_id):
|
||||
"""Delete a service."""
|
||||
return self._delete("/os-services/%s" % service_id)
|
||||
|
@ -2884,6 +2884,12 @@ def do_service_disable(cs, args):
|
||||
utils.print_list([result], ['Host', 'Binary', 'Status'])
|
||||
|
||||
|
||||
@utils.arg('id', metavar='<id>', help=_('Id of service.'))
|
||||
def do_service_delete(cs, args):
|
||||
"""Delete the service."""
|
||||
cs.services.delete(args.id)
|
||||
|
||||
|
||||
@utils.arg('fixed_ip', metavar='<fixed_ip>', help=_('Fixed IP Address.'))
|
||||
def do_fixed_ip_get(cs, args):
|
||||
"""Retrieve info on a fixed ip."""
|
||||
|
@ -2390,6 +2390,12 @@ def do_service_disable(cs, args):
|
||||
utils.print_list([result], ['Host', 'Binary', 'Status'])
|
||||
|
||||
|
||||
@utils.arg('id', metavar='<id>', help='Id of service.')
|
||||
def do_service_delete(cs, args):
|
||||
"""Delete the service."""
|
||||
cs.services.delete(args.id)
|
||||
|
||||
|
||||
@utils.arg('fixed_ip', metavar='<fixed_ip>', help='Fixed IP Address.')
|
||||
def do_fixed_ip_get(cs, args):
|
||||
"""Retrieve info on a fixed ip."""
|
||||
|
Loading…
Reference in New Issue
Block a user