summaryrefslogtreecommitdiff
path: root/openstackclient/network/v2
diff options
context:
space:
mode:
authorTang Chen <tangchen@cn.fujitsu.com>2015-12-05 10:31:54 +0800
committerTang Chen <tangchen@cn.fujitsu.com>2015-12-09 09:29:39 +0800
commit511e8622944bc64822af07b1bd11681b0c5d45b3 (patch)
tree449b89c40bc4b6d7f91d8aed392114d3315ae15d /openstackclient/network/v2
parent0b4fb0bb662d71a85aba251e13d403cf692d8d54 (diff)
downloadpython-openstackclient-511e8622944bc64822af07b1bd11681b0c5d45b3.tar.gz
Migrate "network delete" command to use SDK.
This patch makes "network delete" command use sdk. Since we have to keep the other commands runnable with the old network client, we use a temporary method to create sdk network client. And as a result, the tests need to patch a method to fake the temporary method, which will be removed at last. Change-Id: I1f2c404e4b0ff6727e4c535ce543aa406f2290ce Implements: blueprint neutron-client Co-Authored-By: Terry Howe <terrylhowe@gmail.com> Co-Authored-By: Tang Chen <tangchen@cn.fujitsu.com>
Diffstat (limited to 'openstackclient/network/v2')
-rw-r--r--openstackclient/network/v2/network.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py
index 3b7ae737..9139757b 100644
--- a/openstackclient/network/v2/network.py
+++ b/openstackclient/network/v2/network.py
@@ -156,11 +156,12 @@ class DeleteNetwork(command.Command):
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
+ self.app.client_manager.network = \
+ _make_client_sdk(self.app.client_manager)
client = self.app.client_manager.network
- delete_method = getattr(client, "delete_network")
for network in parsed_args.networks:
- _id = common.find(client, 'network', 'networks', network)
- delete_method(_id)
+ obj = client.find_network(network)
+ client.delete_network(obj)
return