Deprecate security groups related commands
* Print a warning message on the security groups commands to tell users these commands are deprecated. * Add a TODO comment to indicate that the OSC security group commands need further work. Change-Id: I01bf45aa00c3f8e4c4c86636304e675c8d402d55 Implements: blueprint rework-security-group-api
This commit is contained in:
@@ -1140,6 +1140,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)
|
||||
@@ -1171,6 +1174,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)
|
||||
|
||||
@@ -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)
|
||||
@@ -767,7 +773,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.')
|
||||
@@ -885,6 +891,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.')
|
||||
@@ -976,6 +983,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.')
|
||||
|
||||
Reference in New Issue
Block a user