Skip to content

Commit

Permalink
fixup! WIP XS 6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ydirson committed Sep 27, 2024
1 parent f63c99f commit 72f98fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lib/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def _ssh(hostname_or_ip, cmd, check, simple_output, suppress_fingerprint_warning
# Get a decoded version of the output in any case, replacing potential errors
output_for_errors = res.stdout.decode(errors='replace').strip()

# Even if check is False, we still raise in case of return code 255, which means a SSH error.
if res.returncode == 255:
return False, SSHCommandFailed(255, "SSH Error: %s" % output_for_errors, command)
# # Even if check is False, we still raise in case of return code 255, which means a SSH error.
# if res.returncode == 255:
# return False, SSHCommandFailed(255, "SSH Error: %s" % output_for_errors, command)

output = res.stdout
if config.ignore_ssh_banner:
Expand All @@ -125,7 +125,7 @@ def _ssh(hostname_or_ip, cmd, check, simple_output, suppress_fingerprint_warning
if decode:
output = output.decode()

if res.returncode and check:
if res.returncode not in (0, 255) and check:
return False, SSHCommandFailed(res.returncode, output_for_errors, command)

if simple_output:
Expand Down
12 changes: 7 additions & 5 deletions lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,35 @@ def _defn_to_xml_et(defn, /, *, parent=None):

def poweroff(ip):
try:
ssh(ip, ["poweroff"], options=SSHOPTS)
ssh(ip, ["/sbin/poweroff"], options=SSHOPTS)
except SSHCommandFailed as e:
# ignore connection closed by reboot
if e.returncode == 255 and "closed by remote host" in e.stdout:
logging.info("sshd closed the connection")
pass
elif e.returncode == 255:
logging.info("sshd misbehaving?")
else:
raise

def monitor_install(*, ip):
# wait for "yum install" phase to finish
wait_for(lambda: ssh(ip, ["grep",
wait_for(lambda: "DISPATCH: NEW PHASE: Completing installation" in ssh(ip, ["grep",
"'DISPATCH: NEW PHASE: Completing installation'",
"/tmp/install-log"],
check=False, simple_output=False,
options=SSHOPTS,
).returncode == 0,
).stdout,
"Wait for rpm installation to succeed",
timeout_secs=40 * 60) # FIXME too big

# wait for install to finish
wait_for(lambda: ssh(ip, ["grep",
wait_for(lambda: "The installation completed successfully" in ssh(ip, ["grep",
"'The installation completed successfully'",
"/tmp/install-log"],
check=False, simple_output=False,
options=SSHOPTS,
).returncode == 0,
).stdout,
"Wait for system installation to succeed",
timeout_secs=40 * 60) # FIXME too big

Expand Down

0 comments on commit 72f98fa

Please sign in to comment.