← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/utah:sudo-rs-fallout into utah:master

 

Tim Andersson has proposed merging ~andersson123/utah:sudo-rs-fallout into utah:master.

Requested reviews:
  UTAH Dev (utah)

For more details, see:
https://code.launchpad.net/~andersson123/utah/+git/utah/+merge/490595

Fix utah test cases for live server images - utah expects the password prompt from coreutils, not sudo-rs. This commit changes utah to be flexible for both.
-- 
Your team UTAH Dev is requested to review the proposed merge of ~andersson123/utah:sudo-rs-fallout into utah:master.
diff --git a/utah/provisioning/live_server.py b/utah/provisioning/live_server.py
index 10f66d5..4a3d591 100644
--- a/utah/provisioning/live_server.py
+++ b/utah/provisioning/live_server.py
@@ -506,7 +506,27 @@ class LiveServerVM(SSHMixin, LibvirtVM):
                         raise Exception("no output for 10s after %r", buf)
                     c = chan.recv(1).decode()
                     buf += c
-            expect(r'\[sudo\] password for ([a-z]+): ')
+
+            def expect_one_of(pat1, pat2):
+                exception = Exception
+                try:
+                    return expect(pat1)
+                except Exception as e:
+                    exception = e
+                try:
+                    return expect(pat2)
+                except Exception as e:
+                    exception = e
+                raise exception
+
+            # 2025-08-11: This is broken from questing onward (from roughly 2025-08-01)
+            # This is due to the sudo-rs transition - the version of sudo from sudo-rs
+            # has a different password prompt to the legacy one from coreutils.
+            # So, we have to check for both password prompts.
+            expect_one_of(
+                r'\[sudo\] password for ([a-z]+): ',
+                r'\[sudo\: authenticate] Password: ',
+            )
             chan.send('ubuntu\n')
             expect('\r\n')
             m = expect("Sorry|ok")

Follow ups