Fix: Missing value error in match-ldap-to-info 98/73898/1 master v0.37.16
authorAnil Belur <abelur@linuxfoundation.org>
Thu, 20 Nov 2025 12:28:41 +0000 (22:28 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Thu, 20 Nov 2025 12:41:23 +0000 (22:41 +1000)
The code unconditionally tried to remove 'lfservices_releng' from
the user list, causing ValueError when it doesn't exist in the LDAP
group (common in production environments).

Now checks if the user exists before attempting removal.
This was causing info-merge-master jobs to fail.
Fixes: ValueError: list.remove(x): x not in list

Issue: RELENG-5882
Change-Id: I3ca95ac1033c4c80e3642e2fcdbe840179134b14
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
lftools/lfidapi.py
releasenotes/notes/fix-match-ldap-lfservices-releng-8cdcb98e50ab12ba.yaml [new file with mode: 0644]

index bdc7b3a..f245d0e 100755 (executable)
@@ -178,7 +178,8 @@ def helper_match_ldap_to_info(info_file, group, githuborg, noop):
     all_users = ldap_committers + info_committers
 
     if not githuborg:
     all_users = ldap_committers + info_committers
 
     if not githuborg:
-        all_users.remove("lfservices_releng")
+        if "lfservices_releng" in all_users:
+            all_users.remove("lfservices_releng")
 
     log.info("All users in org group")
     all_users = sorted(set(all_users))
 
     log.info("All users in org group")
     all_users = sorted(set(all_users))
diff --git a/releasenotes/notes/fix-match-ldap-lfservices-releng-8cdcb98e50ab12ba.yaml b/releasenotes/notes/fix-match-ldap-lfservices-releng-8cdcb98e50ab12ba.yaml
new file mode 100644 (file)
index 0000000..9890833
--- /dev/null
@@ -0,0 +1,12 @@
+---
+fixes:
+  - |
+    Fix ValueError in match-ldap-to-info when lfservices_releng missing.
+
+    The code unconditionally tried to remove 'lfservices_releng' from
+    the user list, causing a ValueError when it doesn't exist in the
+    LDAP group (common in production environments).
+
+    This was causing info-merge-master jobs to fail.
+
+    Now checks if the user exists before attempting removal.