use-buildset-registry: protect against /var/user/1000 not existing

This is the case on Xenial; we'll just accept that podman and friends
may not work there.

Change-Id: Icd14e4502ff21640a1948671a475448adaf868f5
This commit is contained in:
James E. Blair 2020-03-20 13:28:03 -07:00
parent a68ddd3c5f
commit b4dc66ec33

View File

@ -37,10 +37,18 @@
content: "{{ docker_config | to_nice_json }}" content: "{{ docker_config | to_nice_json }}"
dest: "~/.docker/config.json" dest: "~/.docker/config.json"
mode: 0600 mode: 0600
# The next two tasks are for supporting the "containers" tools (ie,
# not docker); this directory doesn't exist on Xenial.
- name: Check if /run/user exists
stat:
path: "/run/user/{{ ansible_user_uid }}"
register: run_user
- name: Write containers auth configuration - name: Write containers auth configuration
when: run_user.stat.exists
copy: copy:
content: "{{ docker_config | to_nice_json }}" content: "{{ docker_config | to_nice_json }}"
dest: "/run/user/{{ ansible_user_uid }}/auth.json" dest: "/run/user/{{ ansible_user_uid }}/auth.json"
# The next two tasks are for supporting k8s
- name: Check if /var/lib/kubelet exists - name: Check if /var/lib/kubelet exists
stat: stat:
path: /var/lib/kubelet path: /var/lib/kubelet