summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-12-01 21:57:15 +0000
committerGerrit Code Review <review@openstack.org>2016-12-01 21:57:15 +0000
commit3a509be871ec104e46f4a2c11503bdfee0e863b4 (patch)
treeb394301cb7bea9fae81e88010e629f827860e7d3 /openstackclient/network
parentd6e058fa1f6323ef73354f0aea0e09efb647bc7e (diff)
parentabfcd7810cb5937060fd9ae290f07a48226c9ced (diff)
downloadpython-openstackclient-3a509be871ec104e46f4a2c11503bdfee0e863b4.tar.gz
Merge "Introduce overwrite functionality in ``osc subnet set``"
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/subnet.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/openstackclient/network/v2/subnet.py b/openstackclient/network/v2/subnet.py
index eda92948..5366dff6 100644
--- a/openstackclient/network/v2/subnet.py
+++ b/openstackclient/network/v2/subnet.py
@@ -84,6 +84,15 @@ def _get_common_parse_arguments(parser, is_create=True):
help=_("DNS server for this subnet "
"(repeat option to set multiple DNS servers)")
)
+
+ if not is_create:
+ parser.add_argument(
+ '--no-dns-nameservers',
+ action='store_true',
+ help=_("Clear existing information of DNS Nameservers. "
+ "Specify both --dns-nameserver and --no-dns-nameserver "
+ "to overwrite the current DNS Nameserver information.")
+ )
parser.add_argument(
'--host-route',
metavar='destination=<subnet>,gateway=<ip-address>',
@@ -532,7 +541,10 @@ class SetSubnet(command.Command):
attrs = _get_attrs(self.app.client_manager, parsed_args,
is_create=False)
if 'dns_nameservers' in attrs:
- attrs['dns_nameservers'] += obj.dns_nameservers
+ if not parsed_args.no_dns_nameservers:
+ attrs['dns_nameservers'] += obj.dns_nameservers
+ elif parsed_args.no_dns_nameservers:
+ attrs['dns_nameservers'] = []
if 'host_routes' in attrs:
if not parsed_args.no_host_route:
attrs['host_routes'] += obj.host_routes