Do not require 'name' when pulling image

Change-Id: Iabb08fee7ce0d1b6e5364075bcd5e12255ee83b7
Partially-Implements: blueprint kolla-docker-module
This commit is contained in:
SamYaple 2016-01-01 04:18:19 +00:00
parent 912ecd0dfc
commit bef9c081b5

View File

@ -366,7 +366,7 @@ def generate_module():
auth_registry=dict(required=False, type='str'), auth_registry=dict(required=False, type='str'),
auth_username=dict(required=False, type='str'), auth_username=dict(required=False, type='str'),
detach=dict(required=False, type='bool', default=True), detach=dict(required=False, type='bool', default=True),
name=dict(required=True, type='str'), name=dict(required=False, type='str'),
environment=dict(required=False, type='dict'), environment=dict(required=False, type='dict'),
image=dict(required=False, type='str'), image=dict(required=False, type='str'),
insecure_registry=dict(required=False, type='bool', default=False), insecure_registry=dict(required=False, type='bool', default=False),
@ -422,6 +422,13 @@ def main():
msg="missing required arguments: image", msg="missing required arguments: image",
failed=True failed=True
) )
# TODO(SamYaple): Replace with required_if when Ansible 2.0 lands
if (module.params.get('action') != 'pull_image'
and not module.params.get('name')):
self.module.fail_json(
msg="missing required arguments: name",
failed=True
)
try: try:
dw = DockerWorker(module) dw = DockerWorker(module)