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
pull/18777/head
David Shrewsbury 8 years ago committed by Matt Clay
parent 25d829c8f2
commit d0f7af4b09

@ -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

Loading…
Cancel
Save