Fix failures in Docker storage driver check

In some environments the can_talk_to_docker key is missing from the
result of docker_host_info when the call succeeds. Assume we can talk to
Docker if this key is not present, instead of failing due to a missing
attribute error.

Change-Id: I7670410394b0bb5fc96e4166b6a20714f847250b
This commit is contained in:
Pierre Riteau 2020-10-13 23:11:16 +02:00
parent 1b48a7130c
commit 949ed03de5

View File

@ -30,12 +30,12 @@
check_mode: True check_mode: True
register: devicemapper_docker register: devicemapper_docker
when: docker_config_file.stat.exists when: docker_config_file.stat.exists
when: not docker.can_talk_to_docker when: not (docker.can_talk_to_docker | default(true))
- name: Fail if devicemapper is in use while another storage driver was requested - name: Fail if devicemapper is in use while another storage driver was requested
fail: fail:
msg: "Docker storage driver {{ docker_storage_driver }} was requested, but devicemapper is in use" msg: "Docker storage driver {{ docker_storage_driver }} was requested, but devicemapper is in use"
when: (docker.can_talk_to_docker and docker.host_info.Driver == 'devicemapper') or (devicemapper_docker.found | default(0) == 1) when: (docker.can_talk_to_docker | default(true) and docker.host_info.Driver == 'devicemapper') or (devicemapper_docker.found | default(0) == 1)
when: docker_storage_driver != 'devicemapper' when: docker_storage_driver != 'devicemapper'
- name: Ensure Docker devicemapper storage is configured - name: Ensure Docker devicemapper storage is configured