diff --git a/setup.cfg b/setup.cfg index 894aae50..3f96acfe 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,7 +34,7 @@ openstack.container.v1 = appcontainer_show = zunclient.osc.v1.containers:ShowContainer appcontainer_list = zunclient.osc.v1.containers:ListContainer appcontainer_delete = zunclient.osc.v1.containers:DeleteContainer - appcontainer_reboot = zunclient.osc.v1.containers:RebootContainer + appcontainer_restart = zunclient.osc.v1.containers:RestartContainer appcontainer_start = zunclient.osc.v1.containers:StartContainer appcontainer_pause = zunclient.osc.v1.containers:PauseContainer appcontainer_unpause = zunclient.osc.v1.containers:UnpauseContainer diff --git a/zunclient/osc/v1/containers.py b/zunclient/osc/v1/containers.py index 7efd2a9a..c97c2323 100644 --- a/zunclient/osc/v1/containers.py +++ b/zunclient/osc/v1/containers.py @@ -242,22 +242,22 @@ class DeleteContainer(command.Command): {'container': container, 'e': e}) -class RebootContainer(command.Command): - """Reboot specified container""" - log = logging.getLogger(__name__ + ".RebootContainer") +class RestartContainer(command.Command): + """Restart specified container""" + log = logging.getLogger(__name__ + ".RestartContainer") def get_parser(self, prog_name): - parser = super(RebootContainer, self).get_parser(prog_name) + parser = super(RestartContainer, self).get_parser(prog_name) parser.add_argument( 'container', metavar='', nargs='+', - help='ID or name of the (container)s to reboot.') + help='ID or name of the (container)s to restart.') parser.add_argument( '--timeout', metavar='', default=10, - help='Seconds to wait for stop before rebooting (container)s') + help='Seconds to wait for stop before restarting (container)s') return parser def take_action(self, parsed_args): @@ -265,11 +265,11 @@ class RebootContainer(command.Command): containers = parsed_args.container for container in containers: try: - client.containers.reboot(container, parsed_args.timeout) - print(_('Request to reboot container %s has been accepted') + client.containers.restart(container, parsed_args.timeout) + print(_('Request to restart container %s has been accepted') % container) except Exception as e: - print("Reboot for container %(container)s failed: %(e)s" % + print("Restart for container %(container)s failed: %(e)s" % {'container': container, 'e': e}) diff --git a/zunclient/tests/unit/v1/test_containers.py b/zunclient/tests/unit/v1/test_containers.py index 2081c695..94950eb6 100644 --- a/zunclient/tests/unit/v1/test_containers.py +++ b/zunclient/tests/unit/v1/test_containers.py @@ -415,8 +415,8 @@ class ContainerManagerTest(testtools.TestCase): self.assertEqual(expect, self.api.calls) self.assertTrue(containers) - def test_containers_reboot(self): - containers = self.mgr.reboot(CONTAINER1['id'], timeout) + def test_containers_restart(self): + containers = self.mgr.restart(CONTAINER1['id'], timeout) expect = [ ('POST', '/v1/containers/%s/reboot?timeout=10' % CONTAINER1['id'], {'Content-Length': '0'}, None) diff --git a/zunclient/v1/containers.py b/zunclient/v1/containers.py index 3046a53d..61b3b32f 100644 --- a/zunclient/v1/containers.py +++ b/zunclient/v1/containers.py @@ -127,7 +127,7 @@ class ContainerManager(base.Manager): return self._action(id, '/stop', qparams={'timeout': timeout}) - def reboot(self, id, timeout): + def restart(self, id, timeout): return self._action(id, '/reboot', qparams={'timeout': timeout}) diff --git a/zunclient/v1/containers_shell.py b/zunclient/v1/containers_shell.py index b2e7a5d9..5b62a09e 100644 --- a/zunclient/v1/containers_shell.py +++ b/zunclient/v1/containers_shell.py @@ -209,20 +209,20 @@ def do_show(cs, args): @utils.arg('containers', metavar='', nargs='+', - help='ID or name of the (container)s to reboot.') + help='ID or name of the (container)s to restart.') @utils.arg('-t', '--timeout', metavar='', default=10, - help='Seconds to wait for stop before rebooting (container)s') -def do_reboot(cs, args): - """Reboot specified containers.""" + help='Seconds to wait for stop before restarting (container)s') +def do_restart(cs, args): + """Restart specified containers.""" for container in args.containers: try: - cs.containers.reboot(container, args.timeout) - print("Request to reboot container %s has been accepted." % + cs.containers.restart(container, args.timeout) + print("Request to restart container %s has been accepted." % container) except Exception as e: - print("Reboot for container %(container)s failed: %(e)s" % + print("Restart for container %(container)s failed: %(e)s" % {'container': container, 'e': e})