From b304c8979c1bf911fc15caac646c1b80d2c72bd5 Mon Sep 17 00:00:00 2001 From: Ronelle Landy Date: Thu, 20 May 2021 14:07:17 -0400 Subject: [PATCH] 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 --- tasks/yum_install_buildah.yml | 9 +++++++++ tasks/yum_update_buildah.yml | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/tasks/yum_install_buildah.yml b/tasks/yum_install_buildah.yml index 3482cdd..237ff11 100644 --- a/tasks/yum_install_buildah.yml +++ b/tasks/yum_install_buildah.yml @@ -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 }} diff --git a/tasks/yum_update_buildah.yml b/tasks/yum_update_buildah.yml index f2811c1..bbb9970 100644 --- a/tasks/yum_update_buildah.yml +++ b/tasks/yum_update_buildah.yml @@ -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 %}