From 6e84baddb6272e66fc060e4083b056cd29759da2 Mon Sep 17 00:00:00 2001 From: "Joshua C. Randall" Date: Sat, 9 Sep 2017 19:16:48 +0100 Subject: [PATCH] fix os_image so it works when id is None (#29147) Fixes #29145 --- lib/ansible/modules/cloud/openstack/os_image.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/openstack/os_image.py b/lib/ansible/modules/cloud/openstack/os_image.py index de69498ff2..9df1a45cec 100644 --- a/lib/ansible/modules/cloud/openstack/os_image.py +++ b/lib/ansible/modules/cloud/openstack/os_image.py @@ -164,9 +164,11 @@ def main(): if module.params['state'] == 'present': if not image: + kwargs={} + if module.params['id'] is not None: + kwargs['id'] = module.params['id'] image = cloud.create_image( name=module.params['name'], - id=module.params['id'], filename=module.params['filename'], disk_format=module.params['disk_format'], container_format=module.params['container_format'], @@ -174,7 +176,8 @@ def main(): timeout=module.params['timeout'], is_public=module.params['is_public'], min_disk=module.params['min_disk'], - min_ram=module.params['min_ram'] + min_ram=module.params['min_ram'], + **kwargs ) changed = True if not module.params['wait']: