Wait for installer exit and live shell before followup probes
This commit is contained in:
@@ -505,6 +505,17 @@ class Console:
|
||||
re.escape(token.encode()) + rb':INSTALL_EXIT:[0-9]+\x1f')
|
||||
return self.expect(pattern, timeout, failure_pattern=failure)
|
||||
|
||||
def finish_installer(self, token, timeout=30):
|
||||
# Completion text can arrive before the process exits and readline
|
||||
# resumes. Input sent during that gap can be discarded by the TTY.
|
||||
deadline = time.monotonic() + timeout
|
||||
returned = self.expect(rb'\x1e' + re.escape(token.encode()) +
|
||||
rb':INSTALL_EXIT:([0-9]+)\x1f', timeout)
|
||||
status = int(returned.group(1))
|
||||
if status:
|
||||
raise SmokeError(f'Installer returned status {status} after completion')
|
||||
self.expect(rb'hydra-live[^\r\n]*[#$] ', max(0, deadline - time.monotonic()))
|
||||
|
||||
def command(self, command, timeout=60):
|
||||
token = secrets.token_hex(12)
|
||||
self.buffer = b''
|
||||
@@ -818,6 +829,7 @@ def main(argv=None):
|
||||
console.send(password + '\n')
|
||||
console.expect_installer(rb'Installation completed\. Diagnostic log: [^\r\n]+',
|
||||
args.install_timeout, installer_token)
|
||||
console.finish_installer(installer_token)
|
||||
checkpoint('real_installer', b'Installer completed via guest controlling TTY')
|
||||
console.command("sudo -n mkdir -p /mnt/hydra-validation && sudo -n mount /dev/vda2 /mnt/hydra-validation && printf %s " +
|
||||
shlex.quote(sentinel) + " | sudo -n tee /mnt/hydra-validation/var/lib/hydra-acceptance-sentinel >/dev/null && sudo -n umount /mnt/hydra-validation", 60)
|
||||
|
||||
Reference in New Issue
Block a user