Rename 'reboot' to 'restart'
Change-Id: I412fdb2123feb57b9fd5bcdb47ab389271d0d7e0 Closes-Bug: #1682679
This commit is contained in:
@@ -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
|
||||
|
@@ -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='<container>',
|
||||
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='<timeout>',
|
||||
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})
|
||||
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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})
|
||||
|
||||
|
@@ -209,20 +209,20 @@ def do_show(cs, args):
|
||||
@utils.arg('containers',
|
||||
metavar='<container>',
|
||||
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='<timeout>',
|
||||
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})
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user