← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/utah:server-img-promotion-fix2 into utah:master

 

Tim Andersson has proposed merging ~andersson123/utah:server-img-promotion-fix2 into utah:master.

Requested reviews:
  UTAH Dev (utah)

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

A more appropriate fix for the previous issue
-- 
Your team UTAH Dev is requested to review the proposed merge of ~andersson123/utah:server-img-promotion-fix2 into utah:master.
diff --git a/utah/provisioning/live_server.py b/utah/provisioning/live_server.py
index 4a3d591..fb823aa 100644
--- a/utah/provisioning/live_server.py
+++ b/utah/provisioning/live_server.py
@@ -492,7 +492,7 @@ class LiveServerVM(SSHMixin, LibvirtVM):
             chan = self.ssh_client.get_transport().open_session()
             chan.get_pty()
             chan.set_combine_stderr(True)
-            chan.exec_command("sudo su -c 'cp -aT .ssh /root/.ssh && chown root:root -R /root/.ssh && echo ok'")
+            chan.exec_command("sudo --prompt='Password: ' su -c 'cp -aT .ssh /root/.ssh && chown root:root -R /root/.ssh && echo ok'")
 
             def expect(pat):
                 prog = re.compile(pat)
@@ -507,26 +507,7 @@ class LiveServerVM(SSHMixin, LibvirtVM):
                     c = chan.recv(1).decode()
                     buf += c
 
-            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: ',
-            )
+            expect(r'Password: ')
             chan.send('ubuntu\n')
             expect('\r\n')
             m = expect("Sorry|ok")

Follow ups