From b4e9b225b4435a7a3598b70617c1e6eb73613fa0 Mon Sep 17 00:00:00 2001 From: Jens Harbott Date: Tue, 3 Sep 2019 17:36:56 +0000 Subject: [PATCH] Add dns_publish_fixed_ip attribute to subnets With the subnet_dns_publish_fixed_ip extension Neutron has added a new attribute to subnets, allowing to select whether DNS records should be published for fixed IPs from that subnet. Add support for this when creating and updating subnets. [0] https://bugs.launchpad.net/neutron/+bug/1784879 [1] https://review.opendev.org/662405 [2] https://review.opendev.org/662409 Depends-On: https://review.opendev.org/679833 Change-Id: Ia804e878acfd1f05e1f00c2ac9202c1d260827f4 --- openstackclient/network/v2/subnet.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/openstackclient/network/v2/subnet.py b/openstackclient/network/v2/subnet.py index 1f0c2d9478..60994acacd 100644 --- a/openstackclient/network/v2/subnet.py +++ b/openstackclient/network/v2/subnet.py @@ -229,6 +229,10 @@ def _get_attrs(client_manager, parsed_args, is_create=True): attrs['enable_dhcp'] = True if parsed_args.no_dhcp: attrs['enable_dhcp'] = False + if parsed_args.dns_publish_fixed_ip: + attrs['dns_publish_fixed_ip'] = True + if parsed_args.no_dns_publish_fixed_ip: + attrs['dns_publish_fixed_ip'] = False if ('dns_nameservers' in parsed_args and parsed_args.dns_nameservers is not None): attrs['dns_nameservers'] = parsed_args.dns_nameservers @@ -302,6 +306,17 @@ class CreateSubnet(command.ShowOne): action='store_true', help=_("Disable DHCP") ) + dns_publish_fixed_ip_group = parser.add_mutually_exclusive_group() + dns_publish_fixed_ip_group.add_argument( + '--dns-publish-fixed-ip', + action='store_true', + help=_("Enable publishing fixed IPs in DNS") + ) + dns_publish_fixed_ip_group.add_argument( + '--no-dns-publish-fixed-ip', + action='store_true', + help=_("Disable publishing fixed IPs in DNS (default)") + ) parser.add_argument( '--gateway', metavar='', @@ -557,6 +572,17 @@ class SetSubnet(command.Command): action='store_true', help=_("Disable DHCP") ) + dns_publish_fixed_ip_group = parser.add_mutually_exclusive_group() + dns_publish_fixed_ip_group.add_argument( + '--dns-publish-fixed-ip', + action='store_true', + help=_("Enable publishing fixed IPs in DNS") + ) + dns_publish_fixed_ip_group.add_argument( + '--no-dns-publish-fixed-ip', + action='store_true', + help=_("Disable publishing fixed IPs in DNS") + ) parser.add_argument( '--gateway', metavar='',