From 42294ea2d7cff225aa234d6b39356a2322c34568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Irek=20G=C5=82ownia?= <48471627+plirglo@users.noreply.github.com> Date: Wed, 14 Apr 2021 12:01:33 +0200 Subject: [PATCH] [BACKPORT][0.7] Fix task "repository : Wait for yum lock to be released" for CentOS Minimal --- CHANGELOG-0.7.md | 1 + .../roles/repository/tasks/RedHat/setup.yml | 22 +++++++++++++++++++ .../roles/repository/tasks/teardown.yml | 17 ++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/CHANGELOG-0.7.md b/CHANGELOG-0.7.md index c04f8f9bed..54e2cb3775 100644 --- a/CHANGELOG-0.7.md +++ b/CHANGELOG-0.7.md @@ -7,6 +7,7 @@ - [#2164](https://github.com/epiphany-platform/epiphany/issues/2164) - Replace Bintray repository - [#1888](https://github.com/epiphany-platform/epiphany/issues/1888) - epicli upgrade of cluster created by Epiphany v0.5 may fail - [#1908](https://github.com/epiphany-platform/epiphany/issues/1908) - Research why Epiphany nodes hang when memory is overcommited +- [#2067](https://github.com/epiphany-platform/epiphany/issues/2067) - [CentOS] epicli fails on task "repository : Wait for yum lock to be released" on CentOS Minimal ### Added diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/RedHat/setup.yml b/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/RedHat/setup.yml index c0be39d050..0359c34031 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/RedHat/setup.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/RedHat/setup.yml @@ -1,4 +1,26 @@ --- +# Bypass yum run by /etc/cron.daily/rhui-update-client on Azure to avoid error 'yum lockfile is held by another process' +- name: Bypass /etc/cron.daily/rhui-update-client + when: specification.provider in ['azure', 'any'] # any for AzBI module + block: + - name: Check if /etc/cron.daily/rhui-update-client file exists + stat: + path: /etc/cron.daily/rhui-update-client + get_attributes: false + get_checksum: false + get_mime: false + register: stat_rhui_update_client_to_bypass + + - name: Bypass /etc/cron.daily/rhui-update-client by moving to temporary location # it's restored in teardown + command: mv /etc/cron.daily/rhui-update-client /var/tmp/rhui-update-client + when: stat_rhui_update_client_to_bypass.stat.exists + +- name: Wait for yum lock to be released # do not use 'yum' module with 'list' here since it requires yum-utils package + wait_for: + path: /var/run/yum.pid + state: absent + timeout: "{{ yum_lock_timeout }}" + - name: Set SELinux in permissive mode until the machine is rebooted command: setenforce 0 failed_when: false diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/teardown.yml b/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/teardown.yml index 019025f273..cc33fad63e 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/teardown.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/teardown.yml @@ -8,6 +8,23 @@ - name: Disable epirepo shell: /tmp/epi-repository-setup-scripts/disable-epirepo-client.sh +- name: Restore /etc/cron.daily/rhui-update-client + when: + - ansible_os_family == "RedHat" + - specification.provider in ['azure', 'any'] # any for AzBI module + block: + - name: Check if /var/tmp/rhui-update-client file exists + stat: + path: /var/tmp/rhui-update-client + get_attributes: false + get_checksum: false + get_mime: false + register: stat_rhui_update_client_to_restore + + - name: Restore /etc/cron.daily/rhui-update-client + command: /var/tmp/rhui-update-client mv /etc/cron.daily/rhui-update-client + when: stat_rhui_update_client_to_restore.stat.exists + - name: Remove epirepo packages directory file: state: absent