summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorGlenn Van de Water <glenn.van_de_water@nuagenetworks.net>2019-03-08 16:31:23 +0100
committerDean Troyer <dtroyer@gmail.com>2019-03-22 21:28:55 +0000
commit8fe45571b925bc6481c33fab7ccc6071f66f3c4f (patch)
tree350797be4c058ba23d80303572c9b06474706163 /openstackclient/network
parent5e1ae22cdf797ad6b822af0a4bd7729722be4029 (diff)
downloadpython-openstackclient-8fe45571b925bc6481c33fab7ccc6071f66f3c4f.tar.gz
Fix service discovery in functional tests
If a required service is not enabled then we skip the test. The discovery is done by tests/functional/base.py:is_service_enabled but this method is broken, credentials are not passed to the 'openstack service show' command so every call will fail and every test that relies on it will be skipped. This commit fixed that method and the issues that popped up when re-enabling tests. Network segment range: - issue where we assumed network-segment-range extension is always present - issue where we compare integers and string representations of numbers Subnet: - issue where we try to deepcopy an uncopyable object in UnsetSubnet Change-Id: Id3cc907c1ed2a25b49cf6f4a7233e0401a02383a Story: 2005169 Task: 29908 (cherry picked from commit 7741347041b078ca4d687597897194d7797d202d)
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/subnet.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/openstackclient/network/v2/subnet.py b/openstackclient/network/v2/subnet.py
index 5f8113bb..0733f37c 100644
--- a/openstackclient/network/v2/subnet.py
+++ b/openstackclient/network/v2/subnet.py
@@ -681,29 +681,30 @@ class UnsetSubnet(command.Command):
def take_action(self, parsed_args):
client = self.app.client_manager.network
obj = client.find_subnet(parsed_args.subnet, ignore_missing=False)
- tmp_obj = copy.deepcopy(obj)
+
attrs = {}
if parsed_args.dns_nameservers:
- _update_arguments(tmp_obj.dns_nameservers,
+ attrs['dns_nameservers'] = copy.deepcopy(obj.dns_nameservers)
+ _update_arguments(attrs['dns_nameservers'],
parsed_args.dns_nameservers,
'dns-nameserver')
- attrs['dns_nameservers'] = tmp_obj.dns_nameservers
if parsed_args.host_routes:
+ attrs['host_routes'] = copy.deepcopy(obj.host_routes)
_update_arguments(
- tmp_obj.host_routes,
+ attrs['host_routes'],
convert_entries_to_nexthop(parsed_args.host_routes),
'host-route')
- attrs['host_routes'] = tmp_obj.host_routes
if parsed_args.allocation_pools:
- _update_arguments(tmp_obj.allocation_pools,
+ attrs['allocation_pools'] = copy.deepcopy(obj.allocation_pools)
+ _update_arguments(attrs['allocation_pools'],
parsed_args.allocation_pools,
'allocation-pool')
- attrs['allocation_pools'] = tmp_obj.allocation_pools
+
if parsed_args.service_types:
- _update_arguments(tmp_obj.service_types,
+ attrs['service_types'] = copy.deepcopy(obj.service_types)
+ _update_arguments(attrs['service_types'],
parsed_args.service_types,
'service-type')
- attrs['service_types'] = tmp_obj.service_types
if attrs:
client.update_subnet(obj, **attrs)