If cmd and entrypoint not set, don't match them
Hello! I wanted stop the containers matched only by image name, but can't do this, if I not set cmd in playbook. This behavior confused me. If cmd or entrypoint is defined for running container, but not defined in playbook, makes matching behavior as this sample: https://github.com/ansible/ansible-modules-core/blob/devel/cloud/docker/docker.py#L463
This commit is contained in:
parent
5b88ad45ef
commit
2e94affde6
1 changed files with 11 additions and 4 deletions
|
@ -1548,10 +1548,17 @@ class DockerManager(object):
|
||||||
|
|
||||||
image_matches = running_image in repo_tags
|
image_matches = running_image in repo_tags
|
||||||
|
|
||||||
command_matches = command == details['Config']['Cmd']
|
if command == None:
|
||||||
entrypoint_matches = (
|
command_matches = True
|
||||||
entrypoint == details['Config']['Entrypoint']
|
else:
|
||||||
)
|
command_matches = (command == details['Config']['Cmd'])
|
||||||
|
|
||||||
|
if entrypoint == None:
|
||||||
|
entrypoint_matches = True
|
||||||
|
else:
|
||||||
|
entrypoint_matches = (
|
||||||
|
entrypoint == details['Config']['Entrypoint']
|
||||||
|
)
|
||||||
|
|
||||||
matches = (image_matches and command_matches and
|
matches = (image_matches and command_matches and
|
||||||
entrypoint_matches)
|
entrypoint_matches)
|
||||||
|
|
Loading…
Reference in a new issue