Skip to contentSkip to conversation

nfstest: add git-core to the list of install dependencies

PATCH In review Scott Mayhew 2 participants 7 messages Apr 24, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 nfstest: add git-core to the list of install dependencies

Currently git-core won't be installed if you're running nfstest as a dedicated workflow.

---
 playbooks/roles/nfstest/vars/Debian.yml | 1 +
 playbooks/roles/nfstest/vars/RedHat.yml | 1 +
 playbooks/roles/nfstest/vars/Suse.yml   | 1 +
 3 files changed, 3 insertions(+)
playbooks/roles/nfstest/vars/Debian.yml +1 -0
index cb4cfe5..05d87a2 100644
@@ -3,3 +3,4 @@ nfstest_packages:
   - nfs-common
   - python-is-python3
   - tcpdump
+  - git-core
playbooks/roles/nfstest/vars/RedHat.yml +1 -0
index d8c65fb..a14c20e 100644
@@ -3,3 +3,4 @@ nfstest_packages:
   - nfs-utils
   - python-unversioned-command
   - tcpdump
+  - git-core
playbooks/roles/nfstest/vars/Suse.yml +1 -0
index 35fcc8e..76adc4d 100644
@@ -2,3 +2,4 @@
 nfstest_packages:
   - nfs-utils
   - tcpdump
+  - git-core
Signature · 1 line
2.44.0
#1 lore raw

PATCH 2/2 nfstest: fix another RHEL 8-ism

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.

---
 playbooks/roles/nfstest/tasks/main.yml  | 19 +++++++++++++++++++
 playbooks/roles/nfstest/vars/RedHat.yml |  1 -
 2 files changed, 19 insertions(+), 1 deletion(-)
playbooks/roles/nfstest/tasks/main.yml +19 -0
index 1ccd247..d0f7d18 100644
@@ -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
playbooks/roles/nfstest/vars/RedHat.yml +0 -1
index a14c20e..76adc4d 100644
@@ -1,6 +1,5 @@
 ---
 nfstest_packages:
   - nfs-utils
-  - python-unversioned-command
   - tcpdump
   - git-core
Signature · 1 line
2.44.0
#2 lore raw

Re: [PATCH 2/2] nfstest: fix another RHEL 8-ism

Quoted 9 lines · Scott Mayhew

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.

It seems like other workflows have python dependencies like this. Would it be better to put this logic in a common role?

Quoted 58 lines
---
 playbooks/roles/nfstest/tasks/main.yml  | 19 +++++++++++++++++++
 playbooks/roles/nfstest/vars/RedHat.yml |  1 -
 2 files changed, 19 insertions(+), 1 deletion(-)
playbooks/roles/nfstest/tasks/main.yml +19 -0
index 1ccd247..d0f7d18 100644
@@ -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
playbooks/roles/nfstest/vars/RedHat.yml +0 -1
index a14c20e..76adc4d 100644
@@ -1,6 +1,5 @@
 ---
 nfstest_packages:
   - nfs-utils
-  - python-unversioned-command
   - tcpdump
   - git-core
Signature · 1 line
2.44.0
Signature · 1 line
Chuck Lever
#3 lore raw

Re: [PATCH 2/2] nfstest: fix another RHEL 8-ism

Quoted 6 lines · Chuck Lever
Quoted 5 lines · Scott Mayhew

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.

Quoted 7 lines
Quoted 4 lines

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.

It seems like other workflows have python dependencies like this. Would it be better to put this logic in a common role?

Actually it depends on whether any of those workflows are using commands like 'python somescript.py'. On a quick scan, I don't see anything. But if there were, they could probably just be changed to use 'python3 somescript.py' (is anyone using python2 any more?).

The original nfstest patches that you posted had a step that was doing 'python setup.py build', and that's what I was tripping on, which prompted me to suggest installing the python-unversioned-command package.

But in the patches that you committed, you're just running nfstest directly from the git dir (which BTW is the way I've always run nfstest manually in the past). So I don't think we even need the python-unversioned-command package any more, and maybe we can just yank it. I'll do some testing.

-Scott

Quoted 64 lines
Quoted 60 lines
---
 playbooks/roles/nfstest/tasks/main.yml  | 19 +++++++++++++++++++
 playbooks/roles/nfstest/vars/RedHat.yml |  1 -
 2 files changed, 19 insertions(+), 1 deletion(-)
playbooks/roles/nfstest/tasks/main.yml +19 -0
index 1ccd247..d0f7d18 100644
@@ -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
playbooks/roles/nfstest/vars/RedHat.yml +0 -1
index a14c20e..76adc4d 100644
@@ -1,6 +1,5 @@
 ---
 nfstest_packages:
   - nfs-utils
-  - python-unversioned-command
   - tcpdump
   - git-core
Signature · 1 line
2.44.0
Signature · 1 line
Chuck Lever
#4 lore raw

Re: [PATCH 2/2] nfstest: fix another RHEL 8-ism

Quoted 30 lines · Scott Mayhew
Quoted 6 lines · Chuck Lever
Quoted 5 lines · Scott Mayhew

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.

Quoted 7 lines
Quoted 4 lines

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.

It seems like other workflows have python dependencies like this. Would it be better to put this logic in a common role?

Actually it depends on whether any of those workflows are using commands like 'python somescript.py'. On a quick scan, I don't see anything. But if there were, they could probably just be changed to use 'python3 somescript.py' (is anyone using python2 any more?).

The original nfstest patches that you posted had a step that was doing 'python setup.py build', and that's what I was tripping on, which prompted me to suggest installing the python-unversioned-command package.

Quoted 5 lines

But in the patches that you committed, you're just running nfstest directly from the git dir (which BTW is the way I've always run nfstest manually in the past). So I don't think we even need the python-unversioned-command package any more, and maybe we can just yank it. I'll do some testing.

Yeah, one of the distros I was testing just before I committed these patches just didn't have a clean way to manage the python2 v. python3 thing (I think it was OpenSuSE) so I just punted and went with running the tests directly.

I'd like to see nfstest get a little better at dealing with the differences in the way Python installation works on each distro. Maybe I'll bring that up during tomorrow's BoF.

--
Chuck Lever

Reviewed-by on v1 1/2
#5 lore raw
In reply to Scott Mayhew
Quoted 2 lines · Scott Mayhew

Currently git-core won't be installed if you're running nfstest as a dedicated workflow.

I don't think it's the "dedicated workflow" that's the problem, because I use that all the time. I think I have the "Install kernel developer tools" option set or something like that, and that pulls in git, trace-cmd, and other stuff.

But, OK... this is a real dependency for nfstest, so:

Quoted 38 lines
---
 playbooks/roles/nfstest/vars/Debian.yml | 1 +
 playbooks/roles/nfstest/vars/RedHat.yml | 1 +
 playbooks/roles/nfstest/vars/Suse.yml   | 1 +
 3 files changed, 3 insertions(+)
playbooks/roles/nfstest/vars/Debian.yml +1 -0
index cb4cfe5..05d87a2 100644
@@ -3,3 +3,4 @@ nfstest_packages:
   - nfs-common
   - python-is-python3
   - tcpdump
+  - git-core
playbooks/roles/nfstest/vars/RedHat.yml +1 -0
index d8c65fb..a14c20e 100644
@@ -3,3 +3,4 @@ nfstest_packages:
   - nfs-utils
   - python-unversioned-command
   - tcpdump
+  - git-core
playbooks/roles/nfstest/vars/Suse.yml +1 -0
index 35fcc8e..76adc4d 100644
@@ -2,3 +2,4 @@
 nfstest_packages:
   - nfs-utils
   - tcpdump
+  - git-core
Signature · 1 line
2.44.0
Signature · 1 line
Chuck Lever
#6 lore raw
Quoted 8 lines · Chuck Lever
Quoted 2 lines · Scott Mayhew

Currently git-core won't be installed if you're running nfstest as a dedicated workflow.

I don't think it's the "dedicated workflow" that's the problem, because I use that all the time. I think I have the "Install kernel developer tools" option set or something like that, and that pulls in git, trace-cmd, and other stuff.

Ah, maybe that's it. I have some workflows running where I'm not building the kernel, so I'm not installing the kernel developer tools. I'm just installing the latest RHEL8/RHEL9 nightlies and running tests, and those are where I'm seeing the problem.

I'll tweak the commit message.

-Scott

Quoted 48 lines

But, OK... this is a real dependency for nfstest, so:

Quoted 38 lines
---
 playbooks/roles/nfstest/vars/Debian.yml | 1 +
 playbooks/roles/nfstest/vars/RedHat.yml | 1 +
 playbooks/roles/nfstest/vars/Suse.yml   | 1 +
 3 files changed, 3 insertions(+)
playbooks/roles/nfstest/vars/Debian.yml +1 -0
index cb4cfe5..05d87a2 100644
@@ -3,3 +3,4 @@ nfstest_packages:
   - nfs-common
   - python-is-python3
   - tcpdump
+  - git-core
playbooks/roles/nfstest/vars/RedHat.yml +1 -0
index d8c65fb..a14c20e 100644
@@ -3,3 +3,4 @@ nfstest_packages:
   - nfs-utils
   - python-unversioned-command
   - tcpdump
+  - git-core
playbooks/roles/nfstest/vars/Suse.yml +1 -0
index 35fcc8e..76adc4d 100644
@@ -2,3 +2,4 @@
 nfstest_packages:
   - nfs-utils
   - tcpdump
+  - git-core
Signature · 1 line
2.44.0
Signature · 1 line
Chuck Lever