From d0f7af4b096964c13b8f91587688382259c1c9a7 Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Tue, 27 Sep 2016 15:03:21 -0400 Subject: [PATCH] Fix os_network's create_network() call for older shade versions (#5058) A value for the project_id parameter to shade's create_network() call was always being sent, even if no value for 'project' was supplied. This was breaking folks with older versions of shade (< 1.6). Fixes PR https://github.com/ansible/ansible-modules-core/issues/3567 --- lib/ansible/modules/cloud/openstack/os_network.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/openstack/os_network.py b/lib/ansible/modules/cloud/openstack/os_network.py index 9a0c2516310..d80267e8937 100644 --- a/lib/ansible/modules/cloud/openstack/os_network.py +++ b/lib/ansible/modules/cloud/openstack/os_network.py @@ -222,8 +222,12 @@ def main(): if provider and StrictVersion(shade.__version__) < StrictVersion('1.5.0'): module.fail_json(msg="Shade >= 1.5.0 required to use provider options") - net = cloud.create_network(name, shared, admin_state_up, - external, provider, project_id) + if project_id is not None: + net = cloud.create_network(name, shared, admin_state_up, + external, provider, project_id) + else: + net = cloud.create_network(name, shared, admin_state_up, + external, provider) changed = True else: changed = False