Fix linting errors.

This commit is contained in:
Felix Fontein
2025-04-26 11:20:32 +02:00
parent 795e6b23dc
commit 2487d1a0bf
125 changed files with 5778 additions and 5662 deletions
@@ -13,379 +13,379 @@
msg: "Using container names '{{ cname }}' and '{{ cname2 }}', and volume name '{{ vname }}'"
- block:
- name: Get info on Docker host
docker_host_info:
register: output
- name: Get info on Docker host
docker_host_info:
register: output
- name: assert reading docker host facts when docker is running
assert:
that:
- output.host_info.Name is string
- output.containers is not defined
- output.networks is not defined
- output.volumes is not defined
- output.images is not defined
- output.disk_usage is not defined
- output.can_talk_to_docker is true
- name: assert reading docker host facts when docker is running
assert:
that:
- output.host_info.Name is string
- output.containers is not defined
- output.networks is not defined
- output.volumes is not defined
- output.images is not defined
- output.disk_usage is not defined
- output.can_talk_to_docker is true
- block:
- name: Get info on Docker host with invalid api_version
docker_host_info:
api_version: 1.999.999
register: output
ignore_errors: true
- name: Get info on Docker host with invalid api_version
docker_host_info:
api_version: 1.999.999
register: output
ignore_errors: true
- name: assert can_talk_is_docker is false
assert:
that:
- output is failed
- output.can_talk_to_docker is false
- name: assert can_talk_is_docker is false
assert:
that:
- output is failed
- output.can_talk_to_docker is false
- block:
- name: Get info on Docker host with invalid docker_host
docker_host_info:
docker_host: tcp://127.0.0.1:80
register: output
ignore_errors: true
- name: Get info on Docker host with invalid docker_host
docker_host_info:
docker_host: tcp://127.0.0.1:80
register: output
ignore_errors: true
- name: assert can_talk_is_docker is false
assert:
that:
- output is failed
- output.can_talk_to_docker is false
- name: assert can_talk_is_docker is false
assert:
that:
- output is failed
- output.can_talk_to_docker is false
# Container and volume are created so that all lists are non-empty:
# * container and volume lists are non-emtpy because of the created objects;
# * image list is non-empty because the image of the container is there;
# * network list is always non-empty (default networks).
- name: Create running container
docker_container:
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
labels:
key1: value1
key2: value2
state: started
register: container_output
# Container and volume are created so that all lists are non-empty:
# * container and volume lists are non-emtpy because of the created objects;
# * image list is non-empty because the image of the container is there;
# * network list is always non-empty (default networks).
- name: Create running container
docker_container:
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
labels:
key1: value1
key2: value2
state: started
register: container_output
- name: Create running container
docker_container:
image: "{{ docker_test_image_alpine }}"
name: "{{ cname2 }}"
labels:
key2: value2
key3: value3
state: stopped
register: container2_output
- name: Create running container
docker_container:
image: "{{ docker_test_image_alpine }}"
name: "{{ cname2 }}"
labels:
key2: value2
key3: value3
state: stopped
register: container2_output
- assert:
that:
- container_output is changed
- container2_output is changed
- assert:
that:
- container_output is changed
- container2_output is changed
- name: Create a volume
docker_volume:
name: "{{ vname }}"
register: volume_output
- name: Create a volume
docker_volume:
name: "{{ vname }}"
register: volume_output
- assert:
that:
- volume_output is changed
- assert:
that:
- volume_output is changed
- name: Get info on Docker host and list containers
docker_host_info:
containers: true
register: output
- name: Get info on Docker host and list containers
docker_host_info:
containers: true
register: output
- name: assert reading docker host facts when docker is running and list containers
assert:
that:
- 'output.host_info.Name is string'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- 'output.containers[0].Image is string'
- 'output.containers[0].ImageID is not defined'
- name: assert reading docker host facts when docker is running and list containers
assert:
that:
- 'output.host_info.Name is string'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- 'output.containers[0].Image is string'
- 'output.containers[0].ImageID is not defined'
- name: Get info on Docker host and list containers matching filters (single label)
docker_host_info:
containers: true
containers_filters:
label: key1=value1
register: output
- name: Get info on Docker host and list containers matching filters (single label)
docker_host_info:
containers: true
containers_filters:
label: key1=value1
register: output
- name: assert container is returned when filters are matched (single label)
assert:
that: "output.containers | length == 1"
- name: assert container is returned when filters are matched (single label)
assert:
that: "output.containers | length == 1"
- name: Get info on Docker host and list containers matching filters (multiple labels)
docker_host_info:
containers: true
containers_filters:
label:
- key1=value1
- key2=value2
register: output
- name: Get info on Docker host and list containers matching filters (multiple labels)
docker_host_info:
containers: true
containers_filters:
label:
- key1=value1
- key2=value2
register: output
- name: assert container is returned when filters are matched (multiple labels)
assert:
that: "output.containers | length == 1"
- name: assert container is returned when filters are matched (multiple labels)
assert:
that: "output.containers | length == 1"
- name: Get info on Docker host and do not list containers which do not match filters
docker_host_info:
containers: true
containers_filters:
label:
- key1=value1
- key2=value2
- key3=value3
register: output
- name: Get info on Docker host and do not list containers which do not match filters
docker_host_info:
containers: true
containers_filters:
label:
- key1=value1
- key2=value2
- key3=value3
register: output
- name: assert no container is returned when filters are not matched
assert:
that: "output.containers | length == 0"
- name: assert no container is returned when filters are not matched
assert:
that: "output.containers | length == 0"
- name: Get info on Docker host and list containers matching filters (single label, not all containers)
docker_host_info:
containers: true
containers_all: false
containers_filters:
label: key2=value2
register: output
- name: Get info on Docker host and list containers matching filters (single label, not all containers)
docker_host_info:
containers: true
containers_all: false
containers_filters:
label: key2=value2
register: output
- name: Get info on Docker host and list containers matching filters (single label, all containers)
docker_host_info:
containers: true
containers_all: true
containers_filters:
label: key2=value2
register: output_all
- name: Get info on Docker host and list containers matching filters (single label, all containers)
docker_host_info:
containers: true
containers_all: true
containers_filters:
label: key2=value2
register: output_all
- name: assert one resp. two container is returned
assert:
that:
- "output.containers | length == 1"
- "output_all.containers | length == 2"
- name: assert one resp. two container is returned
assert:
that:
- "output.containers | length == 1"
- "output_all.containers | length == 2"
- name: Get info on Docker host and list containers with verbose output
docker_host_info:
containers: true
verbose_output: true
register: output
- name: Get info on Docker host and list containers with verbose output
docker_host_info:
containers: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and list containers with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- 'output.containers[0].Image is string'
- 'output.containers[0].ImageID is string'
- name: assert reading docker host facts when docker is running and list containers with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- 'output.containers[0].Image is string'
- 'output.containers[0].ImageID is string'
- name: Get info on Docker host and list images
docker_host_info:
images: true
register: output
- name: Get info on Docker host and list images
docker_host_info:
images: true
register: output
- name: assert reading docker host facts when docker is running and list images
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images[0].Id is string'
- 'output.images[0].ParentId is not defined'
- 'output.disk_usage is not defined'
- name: assert reading docker host facts when docker is running and list images
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images[0].Id is string'
- 'output.images[0].ParentId is not defined'
- 'output.disk_usage is not defined'
- name: Get info on Docker host and list images with verbose output
docker_host_info:
images: true
verbose_output: true
register: output
- name: Get info on Docker host and list images with verbose output
docker_host_info:
images: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and list images with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images[0].Id is string'
- 'output.images[0].ParentId is string'
- 'output.disk_usage is not defined'
- name: assert reading docker host facts when docker is running and list images with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images[0].Id is string'
- 'output.images[0].ParentId is string'
- 'output.disk_usage is not defined'
- name: Get info on Docker host and list networks
docker_host_info:
networks: true
register: output
- name: Get info on Docker host and list networks
docker_host_info:
networks: true
register: output
- name: assert reading docker host facts when docker is running and list networks
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks[0].Id is string'
- 'output.networks[0].Created is not defined'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- name: assert reading docker host facts when docker is running and list networks
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks[0].Id is string'
- 'output.networks[0].Created is not defined'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- name: Get info on Docker host and list networks with verbose output
docker_host_info:
networks: true
verbose_output: true
register: output
- name: Get info on Docker host and list networks with verbose output
docker_host_info:
networks: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and list networks with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks[0].Id is string'
- 'output.networks[0].Created is string'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- name: assert reading docker host facts when docker is running and list networks with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks[0].Id is string'
- 'output.networks[0].Created is string'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- name: Get info on Docker host and list volumes
docker_host_info:
volumes: true
register: output
- name: Get info on Docker host and list volumes
docker_host_info:
volumes: true
register: output
- name: assert reading docker host facts when docker is running and list volumes
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes[0].Name is string'
- 'output.volumes[0].Mountpoint is not defined'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- name: assert reading docker host facts when docker is running and list volumes
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes[0].Name is string'
- 'output.volumes[0].Mountpoint is not defined'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- name: Get info on Docker host and list volumes with verbose output
docker_host_info:
volumes: true
verbose_output: true
register: output
- name: Get info on Docker host and list volumes with verbose output
docker_host_info:
volumes: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and list volumes with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes[0].Name is string'
- 'output.volumes[0].Mountpoint is string'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- name: assert reading docker host facts when docker is running and list volumes with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes[0].Name is string'
- 'output.volumes[0].Mountpoint is string'
- 'output.images is not defined'
- 'output.disk_usage is not defined'
- name: Get info on Docker host and get disk usage
docker_host_info:
disk_usage: true
register: output
- name: Get info on Docker host and get disk usage
docker_host_info:
disk_usage: true
register: output
- name: assert reading docker host facts when docker is running and get disk usage
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage.LayersSize is number'
- 'output.disk_usage.Images is not defined'
- 'output.disk_usage.Containers is not defined'
- 'output.disk_usage.Volumes is not defined'
- name: assert reading docker host facts when docker is running and get disk usage
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage.LayersSize is number'
- 'output.disk_usage.Images is not defined'
- 'output.disk_usage.Containers is not defined'
- 'output.disk_usage.Volumes is not defined'
- name: Get info on Docker host and get disk usage with verbose output
docker_host_info:
disk_usage: true
verbose_output: true
register: output
- name: Get info on Docker host and get disk usage with verbose output
docker_host_info:
disk_usage: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and get disk usage with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage.LayersSize is number'
- 'output.disk_usage.Images is sequence'
- 'output.disk_usage.Containers is sequence'
- 'output.disk_usage.Volumes is sequence'
- name: assert reading docker host facts when docker is running and get disk usage with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers is not defined'
- 'output.networks is not defined'
- 'output.volumes is not defined'
- 'output.images is not defined'
- 'output.disk_usage.LayersSize is number'
- 'output.disk_usage.Images is sequence'
- 'output.disk_usage.Containers is sequence'
- 'output.disk_usage.Volumes is sequence'
- name: Get info on Docker host, disk usage and get all lists together
docker_host_info:
volumes: true
containers: true
networks: true
images: true
disk_usage: true
register: output
- name: Get info on Docker host, disk usage and get all lists together
docker_host_info:
volumes: true
containers: true
networks: true
images: true
disk_usage: true
register: output
- name: assert reading docker host facts when docker is running, disk usage and get lists together
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers[0].Image is string'
- 'output.containers[0].ImageID is not defined'
- 'output.networks[0].Id is string'
- 'output.networks[0].Created is not defined'
- 'output.volumes[0].Name is string'
- 'output.volumes[0].Mountpoint is not defined'
- 'output.images[0].Id is string'
- 'output.images[0].ParentId is not defined'
- 'output.disk_usage.LayersSize is number'
- 'output.disk_usage.Images is not defined'
- 'output.disk_usage.Containers is not defined'
- 'output.disk_usage.Volumes is not defined'
- name: assert reading docker host facts when docker is running, disk usage and get lists together
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers[0].Image is string'
- 'output.containers[0].ImageID is not defined'
- 'output.networks[0].Id is string'
- 'output.networks[0].Created is not defined'
- 'output.volumes[0].Name is string'
- 'output.volumes[0].Mountpoint is not defined'
- 'output.images[0].Id is string'
- 'output.images[0].ParentId is not defined'
- 'output.disk_usage.LayersSize is number'
- 'output.disk_usage.Images is not defined'
- 'output.disk_usage.Containers is not defined'
- 'output.disk_usage.Volumes is not defined'
- name: Get info on Docker host, disk usage and get all lists together with verbose output
docker_host_info:
volumes: true
containers: true
networks: true
images: true
disk_usage: true
verbose_output: true
register: output
- name: Get info on Docker host, disk usage and get all lists together with verbose output
docker_host_info:
volumes: true
containers: true
networks: true
images: true
disk_usage: true
verbose_output: true
register: output
- name: assert reading docker host facts when docker is running and get disk usage with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers[0].Image is string'
- 'output.containers[0].ImageID is string'
- 'output.networks[0].Id is string'
- 'output.networks[0].Created is string'
- 'output.volumes[0].Name is string'
- 'output.volumes[0].Mountpoint is string'
- 'output.images[0].Id is string'
- 'output.images[0].ParentId is string'
- 'output.disk_usage.LayersSize is number'
- 'output.disk_usage.Images is sequence'
- 'output.disk_usage.Containers is sequence'
- 'output.disk_usage.Volumes is sequence'
- name: assert reading docker host facts when docker is running and get disk usage with verbose output
assert:
that:
- 'output.host_info.Name is string'
- 'output.containers[0].Image is string'
- 'output.containers[0].ImageID is string'
- 'output.networks[0].Id is string'
- 'output.networks[0].Created is string'
- 'output.volumes[0].Name is string'
- 'output.volumes[0].Mountpoint is string'
- 'output.images[0].Id is string'
- 'output.images[0].ParentId is string'
- 'output.disk_usage.LayersSize is number'
- 'output.disk_usage.Images is sequence'
- 'output.disk_usage.Containers is sequence'
- 'output.disk_usage.Volumes is sequence'
always:
- name: Delete containers
docker_container:
name: "{{ item }}"
state: absent
force_kill: true
loop:
- "{{ cname }}"
- "{{ cname2 }}"
- name: Delete containers
docker_container:
name: "{{ item }}"
state: absent
force_kill: true
loop:
- "{{ cname }}"
- "{{ cname2 }}"
- name: Delete volume
docker_volume:
name: "{{ vname }}"
state: absent
- name: Delete volume
docker_volume:
name: "{{ vname }}"
state: absent