summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Pavlov <apavlov@mirantis.com>2016-02-29 16:09:32 +0300
committerAndrey Pavlov <apavlov@mirantis.com>2016-02-29 16:09:32 +0300
commit571b5cd3d0dca981355cb522f8a85c56f95adff1 (patch)
tree124d80d04dfa73aa2b76801b2ea2ccb2926088b8
parent84af8c666ab9a5865c6f4f25a0bbad6b7ff9be37 (diff)
downloadpython-saharaclient-571b5cd3d0dca981355cb522f8a85c56f95adff1.tar.gz
Fixing cluster creation with neutron network via CLI
The OpenStack SDK is now used for the network client in openstackclient. It brakes the "cluster create" CLI command if neutron network is specified. Change-Id: Id099c11973a6d221cfd10aa654b3d44257127ce0 Closes-bug: #1551224
-rw-r--r--saharaclient/osc/v1/clusters.py4
-rw-r--r--saharaclient/tests/unit/osc/v1/test_clusters.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/saharaclient/osc/v1/clusters.py b/saharaclient/osc/v1/clusters.py
index 1602e14..7d1e0bf 100644
--- a/saharaclient/osc/v1/clusters.py
+++ b/saharaclient/osc/v1/clusters.py
@@ -176,8 +176,8 @@ class CreateCluster(show.ShowOne):
image_id = utils.get_resource_id(client.images, parsed_args.image)
- net_id = (network_client.api.find_attr(
- 'networks', parsed_args.neutron_network)['id'] if
+ net_id = (network_client.find_network(
+ parsed_args.neutron_network, ignore_missing=False).id if
parsed_args.neutron_network else None)
data = client.clusters.create(
diff --git a/saharaclient/tests/unit/osc/v1/test_clusters.py b/saharaclient/tests/unit/osc/v1/test_clusters.py
index ba48993..c031763 100644
--- a/saharaclient/tests/unit/osc/v1/test_clusters.py
+++ b/saharaclient/tests/unit/osc/v1/test_clusters.py
@@ -106,8 +106,8 @@ class TestCreateCluster(TestClusters):
None, CT_INFO)
self.img_mock.find_unique.return_value = api_img.Image(
None, {'id': 'img_id'})
- self.net_mock = self.app.client_manager.network.api
- self.net_mock.find_attr.return_value = {'id': 'net_id'}
+ self.net_mock = self.app.client_manager.network
+ self.net_mock.find_network.return_value = mock.Mock(id='net_id')
self.net_mock.reset_mock()
# Command to test