yum: case for multilib when installing from a file (#32236)
This commit is contained in:
parent
38444bb76c
commit
356901b72d
2 changed files with 112 additions and 0 deletions
|
@ -749,6 +749,18 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, i
|
|||
(name, ver, rel, epoch, arch) = splitFilename(envra)
|
||||
installed_pkgs = is_installed(module, repoq, name, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot)
|
||||
|
||||
# case for two same envr but differrent archs like x86_64 and i686
|
||||
if len(installed_pkgs) == 2:
|
||||
(cur_name0, cur_ver0, cur_rel0, cur_epoch0, cur_arch0) = splitFilename(installed_pkgs[0])
|
||||
(cur_name1, cur_ver1, cur_rel1, cur_epoch1, cur_arch1) = splitFilename(installed_pkgs[1])
|
||||
cur_epoch0 = cur_epoch0 or '0'
|
||||
cur_epoch1 = cur_epoch1 or '0'
|
||||
compare = compareEVR((cur_epoch0, cur_ver0, cur_rel0), (cur_epoch1, cur_ver1, cur_rel1))
|
||||
if compare == 0 and cur_arch0 != cur_arch1:
|
||||
for installed_pkg in installed_pkgs:
|
||||
if installed_pkg.endswith(arch):
|
||||
installed_pkgs = [installed_pkg]
|
||||
|
||||
if len(installed_pkgs) == 1:
|
||||
installed_pkg = installed_pkgs[0]
|
||||
(cur_name, cur_ver, cur_rel, cur_epoch, cur_arch) = splitFilename(installed_pkg)
|
||||
|
|
|
@ -32,6 +32,20 @@
|
|||
baseurl: "file://{{ repodir }}"
|
||||
gpgcheck: no
|
||||
|
||||
- name: Create RPMs and put them into a repo (i686)
|
||||
shell: "python /tmp/create-repo.py i686"
|
||||
register: repo_i686
|
||||
|
||||
- set_fact:
|
||||
repodir_i686: "{{ repo_i686.stdout_lines[-1] }}"
|
||||
|
||||
- name: Install the repo (i686)
|
||||
yum_repository:
|
||||
name: "fake-i686"
|
||||
description: "fake-i686"
|
||||
baseurl: "file://{{ repodir_i686 }}"
|
||||
gpgcheck: no
|
||||
|
||||
- name: Create RPMs and put them into a repo (ppc64)
|
||||
shell: "python /tmp/create-repo.py ppc64"
|
||||
register: repo_ppc64
|
||||
|
@ -532,3 +546,89 @@
|
|||
- "'rc' in yum_result"
|
||||
- "'results' in yum_result"
|
||||
# ============================================================================
|
||||
- block:
|
||||
- name: make sure foo is not installed
|
||||
yum:
|
||||
name: foo
|
||||
state: absent
|
||||
|
||||
- name: install foo both archs
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ repodir }}/foo-1.1-1.x86_64.rpm"
|
||||
- "{{ repodir_i686 }}/foo-1.1-1.i686.rpm"
|
||||
|
||||
- name: try to install lower version of foo from rpm file, without allow_downgrade, just one arch
|
||||
yum:
|
||||
name: "{{ repodir_i686 }}/foo-1.0-1.i686.rpm"
|
||||
state: present
|
||||
register: yum_result
|
||||
|
||||
- name: check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: verify installation
|
||||
assert:
|
||||
that:
|
||||
- "rpm_result.rc == 0"
|
||||
- "yum_result.rc == 0"
|
||||
- "not yum_result.changed"
|
||||
- "not yum_result|failed"
|
||||
- "rpm_result.stdout_lines[0].startswith('foo-1.1-1')"
|
||||
- "rpm_result.stdout_lines[1].startswith('foo-1.1-1')"
|
||||
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in yum_result"
|
||||
- "'msg' in yum_result"
|
||||
- "'rc' in yum_result"
|
||||
- "'results' in yum_result"
|
||||
when: ansible_architecture == "x86_64"
|
||||
# ============================================================================
|
||||
- block:
|
||||
- name: make sure foo is not installed
|
||||
yum:
|
||||
name: foo
|
||||
state: absent
|
||||
|
||||
- name: install foo both archs
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ repodir }}/foo-1.0-1.x86_64.rpm"
|
||||
- "{{ repodir_i686 }}/foo-1.0-1.i686.rpm"
|
||||
|
||||
- name: Update both arch in one task using rpm files
|
||||
yum:
|
||||
name: "{{ repodir }}/foo-1.1-1.x86_64.rpm,{{ repodir_i686 }}/foo-1.1-1.i686.rpm"
|
||||
state: present
|
||||
register: yum_result
|
||||
|
||||
- name: check foo with rpm
|
||||
shell: rpm -q foo
|
||||
register: rpm_result
|
||||
|
||||
- name: verify installation
|
||||
assert:
|
||||
that:
|
||||
- "rpm_result.rc == 0"
|
||||
- "yum_result.rc == 0"
|
||||
- "yum_result.changed"
|
||||
- "not yum_result|failed"
|
||||
- "rpm_result.stdout_lines[0].startswith('foo-1.1-1')"
|
||||
- "rpm_result.stdout_lines[1].startswith('foo-1.1-1')"
|
||||
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in yum_result"
|
||||
- "'msg' in yum_result"
|
||||
- "'rc' in yum_result"
|
||||
- "'results' in yum_result"
|
||||
when: ansible_architecture == "x86_64"
|
||||
# ============================================================================
|
||||
|
|
Loading…
Reference in a new issue