Merge "Deprecate security groups related commands"

This commit is contained in:
Zuul
2018-08-21 01:40:54 +00:00
committed by Gerrit Code Review
2 changed files with 16 additions and 2 deletions

View File

@@ -1142,6 +1142,9 @@ class AddSecurityGroup(command.Command):
opts['security_group'] = parsed_args.security_group
opts = zun_utils.remove_null_parms(**opts)
try:
# TODO(hongbin): add_security_group is removed starting from
# API version 1.15. Use Neutron APIs to add security groups
# to container's ports instead.
client.containers.add_security_group(**opts)
print("Request to add security group for container %s "
"has been accepted." % parsed_args.container)
@@ -1173,6 +1176,9 @@ class RemoveSecurityGroup(command.Command):
opts['security_group'] = parsed_args.security_group
opts = zun_utils.remove_null_parms(**opts)
try:
# TODO(hongbin): remove_security_group is removed starting from
# API version 1.15. Use Neutron APIs to remove security groups
# from container's ports instead.
client.containers.remove_security_group(**opts)
print("Request to remove security group from container %s "
"has been accepted." % parsed_args.container)

View File

@@ -28,12 +28,18 @@ from zunclient.common.websocketclient import websocketclient
from zunclient import exceptions as exc
DEPRECATION_MESSAGE = (
RENAME_DEPRECATION_MESSAGE = (
'WARNING: Rename container command deprecated and will be removed '
'in a future release.\nUse Update container command to avoid '
'seeing this message.')
SG_DEPRECATION_MESSAGE = (
'WARNING: Security group related commands deprecated and will be removed '
'in a future release.\nUse Neutron commands to manage security groups '
'instead.')
def _show_container(container):
zun_utils.format_container_addresses(container)
utils.print_dict(container._info)
@@ -769,7 +775,7 @@ def do_update(cs, args):
_show_container(container)
@utils.deprecated(DEPRECATION_MESSAGE)
@utils.deprecated(RENAME_DEPRECATION_MESSAGE)
@utils.arg('container',
metavar='<container>',
help='ID or name of the container to rename.')
@@ -890,6 +896,7 @@ def do_commit(cs, args):
{'container': args.container, 'e': e})
@utils.deprecated(SG_DEPRECATION_MESSAGE)
@utils.arg('container',
metavar='<container>',
help='ID or name of the container to add security group.')
@@ -981,6 +988,7 @@ def do_network_list(cs, args):
zun_utils.list_container_networks(networks)
@utils.deprecated(SG_DEPRECATION_MESSAGE)
@utils.arg('container',
metavar='<container>',
help='ID or name of the container to remove security group.')