summaryrefslogtreecommitdiff
path: root/openstackclient/network/v2/address_group.py
diff options
context:
space:
mode:
authorSlawek Kaplonski <skaplons@redhat.com>2020-12-22 15:31:44 +0100
committerSlawek Kaplonski <skaplons@redhat.com>2021-05-26 09:29:15 +0200
commitb26b7f3440d4f756c0b7906b93751d7e83a733f7 (patch)
treee318e4700f87222b87a4e677e2f7f4dbcf518fae /openstackclient/network/v2/address_group.py
parent6bdf030953d449693c97bff8812b7ced981a2015 (diff)
downloadpython-openstackclient-b26b7f3440d4f756c0b7906b93751d7e83a733f7.tar.gz
Allow to send extra attributes in Neutron related commands
To deprecate and drop support for neutronclient CLI and use only OSC we need feature parity between OSC and neutronclient. Last missing piece here is possibility to send in POST/PUT requests unknown parameters to the Neutron server. This patch adds such possibility to the OSC. Change-Id: Iba09297c2be9fb9fa0be1b3dc65755277b79230e
Diffstat (limited to 'openstackclient/network/v2/address_group.py')
-rw-r--r--openstackclient/network/v2/address_group.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/openstackclient/network/v2/address_group.py b/openstackclient/network/v2/address_group.py
index c5b2f126..fc834700 100644
--- a/openstackclient/network/v2/address_group.py
+++ b/openstackclient/network/v2/address_group.py
@@ -22,6 +22,7 @@ from osc_lib import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
+from openstackclient.network import common
from openstackclient.network import sdk_utils
@@ -57,7 +58,7 @@ def _get_attrs(client_manager, parsed_args):
return attrs
-class CreateAddressGroup(command.ShowOne):
+class CreateAddressGroup(command.ShowOne, common.NeutronCommandWithExtraArgs):
_description = _("Create a new Address Group")
def get_parser(self, prog_name):
@@ -93,6 +94,9 @@ class CreateAddressGroup(command.ShowOne):
client = self.app.client_manager.network
attrs = _get_attrs(self.app.client_manager, parsed_args)
+ attrs.update(
+ self._parse_extra_properties(parsed_args.extra_properties))
+
obj = client.create_address_group(**attrs)
display_columns, columns = _get_columns(obj)
data = utils.get_item_properties(obj, columns, formatters={})
@@ -191,7 +195,7 @@ class ListAddressGroup(command.Lister):
) for s in data))
-class SetAddressGroup(command.Command):
+class SetAddressGroup(common.NeutronCommandWithExtraArgs):
_description = _("Set address group properties")
def get_parser(self, prog_name):
@@ -231,6 +235,9 @@ class SetAddressGroup(command.Command):
attrs['name'] = parsed_args.name
if parsed_args.description is not None:
attrs['description'] = parsed_args.description
+ attrs.update(
+ self._parse_extra_properties(parsed_args.extra_properties))
+
if attrs:
client.update_address_group(obj, **attrs)
if parsed_args.address: