docker_container: fix env_file option (#452)

* Add better tests for env and env_file.

* Make sure that non-container options are also passed to preprocessing code.

* Add changelog fragment.

* Add env_file override test.
This commit is contained in:
Felix Fontein
2022-08-15 07:45:59 +02:00
committed by GitHub
parent f9741b7457
commit f7cf12555c
4 changed files with 73 additions and 1 deletions
@@ -123,6 +123,7 @@ class OptionGroup(object):
return values
self.preprocess = preprocess
self.options = []
self.all_options = []
self.engines = {}
self.ansible_mutually_exclusive = ansible_mutually_exclusive or []
self.ansible_required_together = ansible_required_together or []
@@ -135,6 +136,7 @@ class OptionGroup(object):
option = Option(*args, owner=self, **kwargs)
if not option.not_a_container_option:
self.options.append(option)
self.all_options.append(option)
if not option.not_an_ansible_option:
ansible_option = {
'type': option.ansible_type,
@@ -258,7 +258,7 @@ class ContainerManager(DockerBaseClass):
for options in active_options:
values = {}
engine = options.get_engine(self.engine_driver.name)
for option in options.options:
for option in options.all_options:
if not option.not_an_ansible_option and self.module.params[option.name] is not None:
values[option.name] = self.module.params[option.name]
values = options.preprocess(self.module, values)