Skip to content

Commit 6fa15ca

Browse files
committed
Add ability to force-install some systemd packages to make the flow working
1 parent 2957c79 commit 6fa15ca

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

alts/shared/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@ def __init__(self, **data):
318318
'kernel',
319319
'dnf',
320320
]
321+
force_install_pkgs: List[str] = [
322+
'systemd-standalone-sysusers',
323+
'systemd-standalone-tmpfiles',
324+
]
321325
keepalive_interval: int = 30 # unit in seconds
322326
commands_exec_timeout: int = 30 # unit in seconds
323327
provision_timeout: int = 1200 # 20 minutes in seconds

alts/worker/runners/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,11 +876,13 @@ def install_package_no_log(
876876
package_version=package_version,
877877
package_epoch=package_epoch,
878878
)
879+
force_install = package_name in CONFIG.force_install_pkgs
879880

880881
self._logger.info(
881-
'Installing %s on %s...',
882+
'Installing %s on %s...%s',
882883
full_pkg_name,
883884
self.env_name,
885+
' (force install due to known conflicts)' if force_install else '',
884886
)
885887
cmd_args = [
886888
'-i',
@@ -892,6 +894,8 @@ def install_package_no_log(
892894
f'pkg_version={package_version}',
893895
'-e',
894896
f'dist_name={dist_name}',
897+
'-e',
898+
f'force_install={force_install}',
895899
]
896900
if module_name and module_stream and module_version:
897901
cmd_args.extend([

resources/roles/install_uninstall/tasks/main.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,36 @@
116116
name: "{{ pkg_name }}"
117117
state: present
118118
args: "{{ dnf_args }}"
119-
when: ansible_facts.os_family == 'RedHat'
119+
when:
120+
- ansible_facts.os_family == 'RedHat'
121+
- not (force_install | default(false) | bool)
122+
tags:
123+
- install_package
124+
125+
- name: Force install RPM package (bypass conflicts)
126+
when:
127+
- ansible_facts.os_family == 'RedHat'
128+
- force_install | default(false) | bool
120129
tags:
121130
- install_package
131+
block:
132+
- name: Create temporary directory for forced RPM download
133+
ansible.builtin.file:
134+
path: /tmp/force_install
135+
state: directory
136+
137+
- name: Download RPM package
138+
ansible.builtin.shell:
139+
cmd: "dnf download --destdir=/tmp/force_install {{ pkg_name }}"
140+
141+
- name: Install downloaded RPM bypassing conflicts
142+
ansible.builtin.shell:
143+
cmd: "rpm -i --nodeps --force /tmp/force_install/*.rpm"
144+
145+
- name: Clean up downloaded RPMs
146+
ansible.builtin.file:
147+
path: /tmp/force_install
148+
state: absent
122149

123150
- name: Install DEB package
124151
ansible.builtin.apt:

0 commit comments

Comments
 (0)