Skip to content

Commit

Permalink
Fix task "repository : Wait for yum lock to be released" for CentOS M…
Browse files Browse the repository at this point in the history
…inimal (hitachienergy#2078)

* Bypass rhui-update-client on Azure

* Do not use yum module waiting for yum lock to be released

* Update changelog
  • Loading branch information
to-bar authored and atsikham committed Apr 16, 2021
1 parent d1afcdf commit c807832
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-0.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [#2166](https://github.com/epiphany-platform/epiphany/issues/2166) - Replace Bintray repository
- [#2012](https://github.com/epiphany-platform/epiphany/issues/2012) - Patch cgroup drivers (switch to systemd)
- [#1824](https://github.com/epiphany-platform/epiphany/issues/1824) - offline installation fails with error 'yum lockfile is held by another process' (Azure/RHEL)
- [#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

## [0.9.0] 2021-01-19

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
---
- name: Wait for yum lock to be released
yum:
list: installed
module_defaults:
yum: { lock_timeout: "{{ yum_lock_timeout }}" }
# 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c807832

Please sign in to comment.