Browse Source

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
changes/66/792466/1
Ronelle Landy 3 weeks ago
parent
commit
b304c8979c
2 changed files with 18 additions and 0 deletions
  1. +9
    -0
      tasks/yum_install_buildah.yml
  2. +9
    -0
      tasks/yum_update_buildah.yml

+ 9
- 0
tasks/yum_install_buildah.yml 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 }}


+ 9
- 0
tasks/yum_update_buildah.yml 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 %}


Loading…
Cancel
Save