From 86928a5f748e5850cd4c16f72fe2f33f146ad881 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 28 May 2019 20:48:08 +0200 Subject: [PATCH] docker_image: fix module failing when build option is used without specifying path (#56940) * Fix module failing when build option is used without specifying path. * Add changelog. --- changelogs/fragments/56940-docker_image-fail.yml | 2 ++ lib/ansible/modules/cloud/docker/docker_image.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/56940-docker_image-fail.yml diff --git a/changelogs/fragments/56940-docker_image-fail.yml b/changelogs/fragments/56940-docker_image-fail.yml new file mode 100644 index 00000000000..117d455a7de --- /dev/null +++ b/changelogs/fragments/56940-docker_image-fail.yml @@ -0,0 +1,2 @@ +bugfixes: +- "docker_image - module failed when ``source: build`` was set but ``build.path`` options not specified." diff --git a/lib/ansible/modules/cloud/docker/docker_image.py b/lib/ansible/modules/cloud/docker/docker_image.py index 201c5b53c93..08b2871fbd8 100644 --- a/lib/ansible/modules/cloud/docker/docker_image.py +++ b/lib/ansible/modules/cloud/docker/docker_image.py @@ -886,7 +886,7 @@ def main(): 'has been renamed and will be removed in Ansible 2.12.' % (build_option, option, option)) if client.module.params['source'] == 'build': if (not client.module.params['build'] or not client.module.params['build'].get('path')): - client.module.fail('If "source" is set to "build", the "build.path" option must be specified.') + client.fail('If "source" is set to "build", the "build.path" option must be specified.') if client.module.params['build'].get('pull') is None: client.module.warn("The default for build.pull is currently 'yes', but will be changed to 'no' in Ansible 2.12. " "Please set build.pull explicitly to the value you need.")