docker_image: fix default handling of old docker-build options nocache and rm (#56610)

* Fix usage of nocache parameter.

* Fix defaults.

* Add changelog.
This commit is contained in:
Felix Fontein 2019-05-28 20:47:31 +02:00 committed by GitHub
parent 1b66a13186
commit 56e2d48612
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -0,0 +1,3 @@
bugfixes:
- "docker_image - if ``nocache`` set to ``yes`` but not ``build.nocache``, the module failed."
- "docker_image - if ``build`` was not specified, the wrong default for ``build.rm`` is used."

View file

@ -453,11 +453,11 @@ class ImageManager(DockerBaseClass):
self.load_path = parameters.get('load_path')
self.name = parameters.get('name')
self.network = build.get('network')
self.nocache = build.get('nocache')
self.nocache = build.get('nocache', False)
self.build_path = build.get('path')
self.pull = build.get('pull')
self.repository = parameters.get('repository')
self.rm = build.get('rm')
self.rm = build.get('rm', True)
self.state = parameters.get('state')
self.tag = parameters.get('tag')
self.http_timeout = build.get('http_timeout')
@ -879,7 +879,7 @@ def main():
if client.module.params[option] != default_value:
if client.module.params['build'] is None:
client.module.params['build'] = dict()
if client.module.params['build'].get(build_option) != default_value:
if client.module.params['build'].get(build_option, default_value) != default_value:
client.fail('Cannot specify both %s and build.%s!' % (option, build_option))
client.module.params['build'][build_option] = client.module.params[option]
client.module.warn('Please specify build.%s instead of %s. The %s option '