Only mount /etc/{{ pkg_mgr_suffix }}/vars if it exists

/etc/{{ pkg_mgr_suffix }}/vars exists on stream and
some other platforms but is missing from RHEL 8.x.

This patch checks that that directory exists first
before mounting it.

Change-Id: I048434b38eb1d6b1c83a89d90e01f71d467d7fb7
This commit is contained in:
Ronelle Landy 2021-05-20 14:07:17 -04:00
parent 2c53d70612
commit b304c8979c
2 changed files with 18 additions and 0 deletions

View File

@ -38,13 +38,20 @@
chdir: "{{ yum_repos_dir_path }}"
register: file_repos
- name: Find if /etc/{{ pkg_mgr_suffix }}/vars exists
stat:
path: /etc/{{ pkg_mgr_suffix }}/vars
register: pkg_mgr_vars_stat
- block:
- name: Run yum_install.sh
command: >
buildah run
--volume {{ yum_install.path }}:/tmp/yum_install.sh
--volume {{ yum_repos_dir_path }}:/etc/yum.repos.d
{% if pkg_mgr_vars_stat.stat.exists %}
--volume /etc/{{ pkg_mgr_suffix }}/vars:/etc/{{ pkg_mgr_suffix }}/vars
{% endif %}
{% for repo in file_repos.stdout_lines %}
{% if repo is exists %}
--volume {{ repo }}:{{ repo }}
@ -62,7 +69,9 @@
buildah --debug run
--volume {{ yum_install.path }}:/tmp/yum_install.sh
--volume {{ yum_repos_dir_path }}:/etc/yum.repos.d
{% if pkg_mgr_vars_stat.stat.exists %}
--volume /etc/{{ pkg_mgr_suffix }}/vars:/etc/{{ pkg_mgr_suffix }}/vars
{% endif %}
{% for repo in file_repos.stdout_lines %}
{% if repo is exists %}
--volume {{ repo }}:{{ repo }}

View File

@ -48,6 +48,11 @@
register: file_repos
when: rpms_path is undefined
- name: Find if /etc/{{ pkg_mgr_suffix }}/vars exists
stat:
path: /etc/{{ pkg_mgr_suffix }}/vars
register: pkg_mgr_vars_stat
- name: Define bind-mount modes for yum cache to be populated or used
when: yum_cache is defined and yum_cache
block:
@ -103,7 +108,9 @@
buildah run
--volume {{ yum_update.path }}:/tmp/yum_update.sh
--volume {{ yum_repos_dir_path }}:/etc/yum.repos.d
{% if pkg_mgr_vars_stat.stat.exists %}
--volume /etc/{{ pkg_mgr_suffix }}/vars:/etc/{{ pkg_mgr_suffix }}/vars
{% endif %}
--volume /etc/pki:/etc/pki
{% if cache_volume is defined and cache_volume %}
--volume {{ cache_volume }}
@ -125,7 +132,9 @@
buildah --debug run
--volume {{ yum_update.path }}:/tmp/yum_update.sh
--volume {{ yum_repos_dir_path }}:/etc/yum.repos.d
{% if pkg_mgr_vars_stat.stat.exists %}
--volume /etc/{{ pkg_mgr_suffix }}/vars:/etc/{{ pkg_mgr_suffix }}/vars
{% endif %}
--volume /etc/pki:/etc/pki
{% for repo in file_repos.stdout_lines %}
{% if repo is exists %}