Add OSC Plugin for openstack appcontainer unpause

This change implements the "openstack appcontainer unpause" command
 Based on existing zun command: zun unpause

Partially Implements:blueprint zun-osc-plugin

Change-Id: Icee4741e9b0c0e3ed6124be46a769b1c538f2a15
This commit is contained in:
Namrata Sitlani
2017-01-05 11:45:55 +00:00
committed by Hongbin Lu
parent d4be58a54d
commit ddb16af739
2 changed files with 27 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ openstack.container.v1 =
appcontainer_reboot = zunclient.osc.v1.containers:RebootContainer
appcontainer_start = zunclient.osc.v1.containers:StartContainer
appcontainer_pause = zunclient.osc.v1.containers:PauseContainer
appcontainer_unpause = zunclient.osc.v1.containers:UnpauseContainer
[build_sphinx]
source-dir = doc/source

View File

@@ -275,3 +275,29 @@ class PauseContainer(command.Command):
except Exception as e:
print("Pause for container %(container)s failed: %(e)s" %
{'container': container, 'e': e})
class UnpauseContainer(command.Command):
"""unpause specified container"""
log = logging.getLogger(__name__ + ".UnpauseContainer")
def get_parser(self, prog_name):
parser = super(UnpauseContainer, self).get_parser(prog_name)
parser.add_argument(
'container',
metavar='<container>',
nargs='+',
help='ID or name of the (container)s to unpause.')
return parser
def take_action(self, parsed_args):
client = _get_client(self, parsed_args)
containers = parsed_args.container
for container in containers:
try:
client.containers.unpause(container)
print(_('Request to unpause container %s has been accepted')
% container)
except Exception as e:
print("unpause for container %(container)s failed: %(e)s" %
{'container': container, 'e': e})