public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Scott Mayhew <smayhew@redhat.com>
To: kdevops@lists.linux.dev
Subject: [PATCH 2/2] nfstest: fix another RHEL 8-ism
Date: Wed, 24 Apr 2024 17:15:11 -0400	[thread overview]
Message-ID: <20240424211511.2619637-2-smayhew@redhat.com> (raw)
In-Reply-To: <20240424211511.2619637-1-smayhew@redhat.com>

RHEL 8 doesn't have the python-unversioned-command package.  So we'll
install python-unversioned-command on RHEL/CentOS 9 and higher, and on
RHEL/CentOS 8 and lower we'll set up the /usr/bin/python symlink via
the 'alternatives' command.

I'm not doing any special checking on Fedora, which has had the
python-unversioned-command package since F29.  I'm assuming anyone using
kdevops to run nfstest on Fedora is going to be using a much more recent
version.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 playbooks/roles/nfstest/tasks/main.yml  | 19 +++++++++++++++++++
 playbooks/roles/nfstest/vars/RedHat.yml |  1 -
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/playbooks/roles/nfstest/tasks/main.yml b/playbooks/roles/nfstest/tasks/main.yml
index 1ccd247..d0f7d18 100644
--- a/playbooks/roles/nfstest/tasks/main.yml
+++ b/playbooks/roles/nfstest/tasks/main.yml
@@ -23,6 +23,14 @@
         - 'vars'
   tags: vars
 
+- name: Add python-unversioned-command to list of nfstest packages
+  ansible.builtin.set_fact:
+    nfstest_packages: "{{ nfstest_packages + ['python-unversioned-command'] }}"
+  when:
+    - ansible_facts['os_family']|lower == 'redhat'
+    - ansible_facts['distribution_major_version'] | int >= 9
+  tags: vars
+
 - name: Install dependencies for nfstest
   become: true
   become_flags: 'su - -c'
@@ -32,6 +40,17 @@
     state: present
   tags: nfstest
 
+- name: Set /usr/bin/python symlink
+  become: true
+  become_flags: 'su - -c'
+  become_method: ansible.builtin.sudo
+  ansible.builtin.shell:
+    cmd: alternatives --set python /usr/bin/python3
+  when:
+    - ansible_facts['os_family']|lower == 'redhat'
+    - ansible_facts['distribution_major_version'] | int <= 8
+  tags: nfstest
+
 - name: Create the /data mount point on the target nodes
   ansible.builtin.include_role:
     name: create_data_partition
diff --git a/playbooks/roles/nfstest/vars/RedHat.yml b/playbooks/roles/nfstest/vars/RedHat.yml
index a14c20e..76adc4d 100644
--- a/playbooks/roles/nfstest/vars/RedHat.yml
+++ b/playbooks/roles/nfstest/vars/RedHat.yml
@@ -1,6 +1,5 @@
 ---
 nfstest_packages:
   - nfs-utils
-  - python-unversioned-command
   - tcpdump
   - git-core
-- 
2.44.0


  reply	other threads:[~2024-04-24 21:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24 21:15 [PATCH 1/2] nfstest: add git-core to the list of install dependencies Scott Mayhew
2024-04-24 21:15 ` Scott Mayhew [this message]
2024-04-24 21:21   ` [PATCH 2/2] nfstest: fix another RHEL 8-ism Chuck Lever
2024-04-24 22:00     ` Scott Mayhew
2024-04-24 22:52       ` Chuck Lever III
2024-04-24 21:19 ` [PATCH 1/2] nfstest: add git-core to the list of install dependencies Chuck Lever
2024-04-24 21:50   ` Scott Mayhew

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240424211511.2619637-2-smayhew@redhat.com \
    --to=smayhew@redhat.com \
    --cc=kdevops@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox