Skip to contentSkip to conversation

fstests: Make the use of "--badname" conditional

PATCH In review [email protected] 2 participants 2 messages Apr 21, 2024 – Apr 22, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fstests: Make the use of "--badname" conditional

From: Chuck Lever <[email protected]>

RHEL 8 does not implement "useradd --badname". Use the --badname option conditionally, based on OS family.

Fixes 08f095cf74f1 ("fstests: Enable creation of group "123456-fsgqa" on SuSE")
---
 playbooks/roles/fstests/defaults/main.yml                | 1 +
 playbooks/roles/fstests/tasks/install-deps/suse/main.yml | 4 ++++
 playbooks/roles/fstests/tasks/main.yml                   | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
playbooks/roles/fstests/defaults/main.yml +1 -0
index 72100e934c39..302341420b58 100644
@@ -12,6 +12,7 @@ infer_uid_and_group: False
 oscheck_extra_args: ""
 limit_tests: ""
 dynamic_limit_tests:
+badname_arg: ""
 
 fstests_start_after: False
 fstests_start_after_test: ""
playbooks/roles/fstests/tasks/install-deps/suse/main.yml +4 -0
index 4520451dffbd..c4df15b9d677 100644
@@ -247,3 +247,7 @@
   when:
     - repos_present|bool
     - fstests_fstyp == "cifs"
+
+- name: Set the "--badname" arg
+  ansible.builtin.set_fact:
+    badname_arg: "--badname"
playbooks/roles/fstests/tasks/main.yml +1 -1
index 6a78ff0938de..68f94fe8ed3e 100644
@@ -882,7 +882,7 @@
   become: yes
   become_flags: 'su - -c'
   become_method: sudo
-  ansible.builtin.command: "useradd --badname -d /home/{{ item }} -U {{ item }}"
+  ansible.builtin.command: "useradd {{ badname_arg }} -d /home/{{ item }} -U {{ item }}"
   with_items:
     - 123456-fsgqa
     - fsgqa

base-commit: 1599e4587893efc07569f97adf7430935b6cf31c

Signature · 1 line
2.44.0
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Sun, 21 Apr 2024, [email protected] wrote:

From: Chuck Lever <[email protected]>

RHEL 8 does not implement "useradd --badname". Use the --badname option conditionally, based on OS family.

Fixes 08f095cf74f1 ("fstests: Enable creation of group "123456-fsgqa" on SuSE")

Thanks, that fixes the issue on RHEL8 for me.

-Scott

Quoted 49 lines
---
 playbooks/roles/fstests/defaults/main.yml                | 1 +
 playbooks/roles/fstests/tasks/install-deps/suse/main.yml | 4 ++++
 playbooks/roles/fstests/tasks/main.yml                   | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
playbooks/roles/fstests/defaults/main.yml +1 -0
index 72100e934c39..302341420b58 100644
@@ -12,6 +12,7 @@ infer_uid_and_group: False
 oscheck_extra_args: ""
 limit_tests: ""
 dynamic_limit_tests:
+badname_arg: ""
 
 fstests_start_after: False
 fstests_start_after_test: ""
playbooks/roles/fstests/tasks/install-deps/suse/main.yml +4 -0
index 4520451dffbd..c4df15b9d677 100644
@@ -247,3 +247,7 @@
   when:
     - repos_present|bool
     - fstests_fstyp == "cifs"
+
+- name: Set the "--badname" arg
+  ansible.builtin.set_fact:
+    badname_arg: "--badname"
playbooks/roles/fstests/tasks/main.yml +1 -1
index 6a78ff0938de..68f94fe8ed3e 100644
@@ -882,7 +882,7 @@
   become: yes
   become_flags: 'su - -c'
   become_method: sudo
-  ansible.builtin.command: "useradd --badname -d /home/{{ item }} -U {{ item }}"
+  ansible.builtin.command: "useradd {{ badname_arg }} -d /home/{{ item }} -U {{ item }}"
   with_items:
     - 123456-fsgqa
     - fsgqa

base-commit: 1599e4587893efc07569f97adf7430935b6cf31c

Signature · 1 line
2.44.0