diff --git a/changelogs/fragments/65632-docker-argspec-fixup.yml b/changelogs/fragments/65632-docker-argspec-fixup.yml new file mode 100644 index 00000000000..a9742610248 --- /dev/null +++ b/changelogs/fragments/65632-docker-argspec-fixup.yml @@ -0,0 +1,3 @@ +bugfixes: +- "docker_image - fix validation of build options." +- "docker_login - fix error handling when ``username`` or ``password`` is not specified when ``state`` is ``present``." diff --git a/lib/ansible/modules/cloud/docker/docker_image.py b/lib/ansible/modules/cloud/docker/docker_image.py index 1cb42adc9cf..363a66505fd 100644 --- a/lib/ansible/modules/cloud/docker/docker_image.py +++ b/lib/ansible/modules/cloud/docker/docker_image.py @@ -804,7 +804,7 @@ class ImageManager(DockerBaseClass): def main(): argument_spec = dict( source=dict(type='str', choices=['build', 'load', 'pull', 'local']), - build=dict(type='dict', suboptions=dict( + build=dict(type='dict', options=dict( cache_from=dict(type='list', elements='str'), container_limits=dict(type='dict', options=dict( memory=dict(type='int'), diff --git a/lib/ansible/modules/cloud/docker/docker_image_info.py b/lib/ansible/modules/cloud/docker/docker_image_info.py index f3c3b79ccb3..57912f961ac 100644 --- a/lib/ansible/modules/cloud/docker/docker_image_info.py +++ b/lib/ansible/modules/cloud/docker/docker_image_info.py @@ -37,9 +37,9 @@ options: - An image name or a list of image names. Name format will be C(name[:tag]) or C(repository/name[:tag]), where C(tag) is optional. If a tag is not provided, C(latest) will be used. Instead of image names, also image IDs can be used. + - If no name is provided, a list of all images will be returned. type: list elements: str - required: yes extends_documentation_fragment: - docker diff --git a/lib/ansible/modules/cloud/docker/docker_login.py b/lib/ansible/modules/cloud/docker/docker_login.py index 6bebb354428..91fa7a7028c 100644 --- a/lib/ansible/modules/cloud/docker/docker_login.py +++ b/lib/ansible/modules/cloud/docker/docker_login.py @@ -29,7 +29,6 @@ description: - Running in check mode will perform the authentication without updating the config file. options: registry_url: - required: False description: - The registry URL. type: str @@ -39,16 +38,15 @@ options: - url username: description: - - The username for the registry account + - The username for the registry account. + - Required when I(state) is C(present). type: str - required: yes password: description: - - The plaintext password for the registry account + - The plaintext password for the registry account. + - Required when I(state) is C(present). type: str - required: yes email: - required: False description: - Does nothing, do not use. - Will be removed in Ansible 2.14. diff --git a/lib/ansible/modules/cloud/docker/docker_stack.py b/lib/ansible/modules/cloud/docker/docker_stack.py index 339f6f9f410..342abe381d1 100644 --- a/lib/ansible/modules/cloud/docker/docker_stack.py +++ b/lib/ansible/modules/cloud/docker/docker_stack.py @@ -218,7 +218,7 @@ def main(): 'prune': dict(type='bool', default=False), 'with_registry_auth': dict(type='bool', default=False), 'resolve_image': dict(type='str', choices=['always', 'changed', 'never']), - 'state': dict(tpye='str', default='present', choices=['present', 'absent']), + 'state': dict(type='str', default='present', choices=['present', 'absent']), 'absent_retries': dict(type='int', default=0), 'absent_retries_interval': dict(type='int', default=1) }, diff --git a/lib/ansible/modules/cloud/docker/docker_swarm.py b/lib/ansible/modules/cloud/docker/docker_swarm.py index 304c2b12b85..4fd4c875c41 100644 --- a/lib/ansible/modules/cloud/docker/docker_swarm.py +++ b/lib/ansible/modules/cloud/docker/docker_swarm.py @@ -76,7 +76,6 @@ options: Note that removing requires Docker SDK for Python >= 2.4.0. - Set to C(inspect) to display swarm informations. type: str - required: yes default: present choices: - present diff --git a/lib/ansible/modules/cloud/docker/docker_swarm_service.py b/lib/ansible/modules/cloud/docker/docker_swarm_service.py index 7f0316019da..a1fd366558f 100644 --- a/lib/ansible/modules/cloud/docker/docker_swarm_service.py +++ b/lib/ansible/modules/cloud/docker/docker_swarm_service.py @@ -55,7 +55,6 @@ options: description: - Name of the file containing the config. Defaults to the I(config_name) if not specified. type: str - required: yes uid: description: - UID of the config file's owner. @@ -194,7 +193,6 @@ options: - Service image path and tag. - Corresponds to the C(IMAGE) parameter of C(docker service create). type: str - required: yes labels: description: - Dictionary of key value pairs. @@ -640,7 +638,6 @@ options: - C(present) - Asserts the existence of a service matching the name and provided configuration parameters. Unspecified configuration parameters will be set to docker defaults. type: str - required: yes default: present choices: - present diff --git a/test/integration/targets/docker_image/tasks/tests/options.yml b/test/integration/targets/docker_image/tasks/tests/options.yml index 42c23e0c1a2..f21bbda9107 100644 --- a/test/integration/targets/docker_image/tasks/tests/options.yml +++ b/test/integration/targets/docker_image/tasks/tests/options.yml @@ -282,7 +282,7 @@ name: "{{ iname }}" build: path: "{{ role_path }}/files" - dockefile: "EtcHostsDockerfile" + dockerfile: "EtcHostsDockerfile" pull: no etc_hosts: some-custom-host: "127.0.0.1" diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 9bedd603e7e..9bb90b19b58 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -787,10 +787,6 @@ lib/ansible/modules/cloud/dimensiondata/dimensiondata_vlan.py validate-modules:d lib/ansible/modules/cloud/dimensiondata/dimensiondata_vlan.py validate-modules:doc-required-mismatch lib/ansible/modules/cloud/dimensiondata/dimensiondata_vlan.py validate-modules:parameter-type-not-in-doc lib/ansible/modules/cloud/docker/docker_container.py use-argspec-type-path # uses colon-separated paths, can't use type=path -lib/ansible/modules/cloud/docker/docker_image_info.py validate-modules:doc-required-mismatch -lib/ansible/modules/cloud/docker/docker_login.py validate-modules:doc-required-mismatch -lib/ansible/modules/cloud/docker/docker_swarm.py validate-modules:doc-required-mismatch -lib/ansible/modules/cloud/docker/docker_swarm_service.py validate-modules:doc-required-mismatch lib/ansible/modules/cloud/google/_gcdns_record.py validate-modules:parameter-type-not-in-doc lib/ansible/modules/cloud/google/_gcdns_zone.py validate-modules:parameter-type-not-in-doc lib/ansible/modules/cloud/google/_gce.py pylint:blacklisted-name