Merge pull request #4315 from chouseknecht/devel

Added implementation of ignore_image
reviewable/pr18780/r1
Chris Houseknecht 8 years ago committed by GitHub
commit c6ce77ec4c

@ -45,7 +45,7 @@ options:
- Use with I(detach) to remove the container after successful execution. - Use with I(detach) to remove the container after successful execution.
default: false default: false
required: false required: false
version_added: 2.2 version_added: "2.2"
command: command:
description: description:
- Command to execute when the container starts. - Command to execute when the container starts.
@ -150,10 +150,11 @@ options:
description: description:
- When C(state) is I(present) or I(started) the module compares the configuration of an existing - When C(state) is I(present) or I(started) the module compares the configuration of an existing
container to requested configuration. The evaluation includes the image version. If container to requested configuration. The evaluation includes the image version. If
the image vesion in the registry does not match the container, the container will be the image version in the registry does not match the container, the container will be
recreated. Stop this behavior by setting C(ignore_image) to I(True). recreated. Stop this behavior by setting C(ignore_image) to I(True).
default: false default: false
required: false required: false
version_added: "2.2"
image: image:
description: description:
- Repository path and tag used to create the container. If an image is not found or pull is true, the image - Repository path and tag used to create the container. If an image is not found or pull is true, the image
@ -691,6 +692,7 @@ class TaskParameters(DockerBaseClass):
self.force_kill = None self.force_kill = None
self.groups = None self.groups = None
self.hostname = None self.hostname = None
self.ignore_image = None
self.image = None self.image = None
self.interactive = None self.interactive = None
self.ipc_mode = None self.ipc_mode = None
@ -1629,6 +1631,8 @@ class ContainerManager(DockerBaseClass):
else: else:
# Existing container # Existing container
different, differences = container.has_different_configuration(image) different, differences = container.has_different_configuration(image)
image_different = False
if not self.parameters.ignore_image:
image_different = self._image_is_different(image, container) image_different = self._image_is_different(image, container)
if image_different or different or self.parameters.recreate: if image_different or different or self.parameters.recreate:
self.diff['differences'] = differences self.diff['differences'] = differences
@ -1892,6 +1896,7 @@ def main():
force_kill=dict(type='bool', default=False, aliases=['forcekill']), force_kill=dict(type='bool', default=False, aliases=['forcekill']),
groups=dict(type='list'), groups=dict(type='list'),
hostname=dict(type='str'), hostname=dict(type='str'),
ignore_image=dict(type='bool', default=False),
image=dict(type='str'), image=dict(type='str'),
interactive=dict(type='bool', default=False), interactive=dict(type='bool', default=False),
ipc_mode=dict(type='str'), ipc_mode=dict(type='str'),

Loading…
Cancel
Save