Skip to content

Commit 2530265

Browse files
committed
Merge branch 'install-6.5'
2 parents d768ea5 + b7d5cce commit 2530265

File tree

4 files changed

+35
-13
lines changed

4 files changed

+35
-13
lines changed

Diff for: lib/commands.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ def _ssh(hostname_or_ip, cmd, check, simple_output, suppress_fingerprint_warning
112112
# Get a decoded version of the output in any case, replacing potential errors
113113
output_for_errors = res.stdout.decode(errors='replace').strip()
114114

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

119119
output = res.stdout
120120
if config.ignore_ssh_banner:
@@ -125,7 +125,7 @@ def _ssh(hostname_or_ip, cmd, check, simple_output, suppress_fingerprint_warning
125125
if decode:
126126
output = output.decode()
127127

128-
if res.returncode and check:
128+
if res.returncode not in (0, 255) and check:
129129
return False, SSHCommandFailed(res.returncode, output_for_errors, command)
130130

131131
if simple_output:

Diff for: lib/installer.py

+23-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
from lib.commands import ssh, SSHCommandFailed
66
from lib.common import wait_for
77

8+
# FIXME should only be used for <7.0
9+
SSHOPTS = ("-o KexAlgorithms=+diffie-hellman-group1-sha1",
10+
"-o HostKeyAlgorithms=+ssh-rsa",
11+
"-o PubkeyAcceptedKeyTypes=+ssh-rsa",
12+
"-c +aes256-cbc")
13+
814
class AnswerFile:
915
def __init__(self, kind, /):
1016
from data import BASE_ANSWERFILES
@@ -62,36 +68,41 @@ def _defn_to_xml_et(defn, /, *, parent=None):
6268

6369
def poweroff(ip):
6470
try:
65-
ssh(ip, ["poweroff"])
71+
ssh(ip, ["/sbin/poweroff"], options=SSHOPTS)
6672
except SSHCommandFailed as e:
6773
# ignore connection closed by reboot
6874
if e.returncode == 255 and "closed by remote host" in e.stdout:
6975
logging.info("sshd closed the connection")
7076
pass
77+
elif e.returncode == 255:
78+
logging.info("sshd misbehaving?")
7179
else:
7280
raise
7381

7482
def monitor_install(*, ip):
7583
# wait for "yum install" phase to finish
76-
wait_for(lambda: ssh(ip, ["grep",
84+
wait_for(lambda: "DISPATCH: NEW PHASE: Completing installation" in ssh(ip, ["grep",
7785
"'DISPATCH: NEW PHASE: Completing installation'",
7886
"/tmp/install-log"],
7987
check=False, simple_output=False,
80-
).returncode == 0,
88+
options=SSHOPTS,
89+
).stdout,
8190
"Wait for rpm installation to succeed",
8291
timeout_secs=40 * 60) # FIXME too big
8392

8493
# wait for install to finish
85-
wait_for(lambda: ssh(ip, ["grep",
94+
wait_for(lambda: "The installation completed successfully" in ssh(ip, ["grep",
8695
"'The installation completed successfully'",
8796
"/tmp/install-log"],
8897
check=False, simple_output=False,
89-
).returncode == 0,
98+
options=SSHOPTS,
99+
).stdout,
90100
"Wait for system installation to succeed",
91101
timeout_secs=40 * 60) # FIXME too big
92102

93103
wait_for(lambda: ssh(ip, ["ps a|grep '[0-9]. python /opt/xensource/installer/init'"],
94104
check=False, simple_output=False,
105+
options=SSHOPTS,
95106
).returncode == 1,
96107
"Wait for installer to terminate")
97108

@@ -101,6 +112,7 @@ def monitor_upgrade(*, ip):
101112
"'DISPATCH: NEW PHASE: Reading package information'",
102113
"/tmp/install-log"],
103114
check=False, simple_output=False,
115+
options=SSHOPTS,
104116
).returncode == 0,
105117
"Wait for upgrade preparations to finish",
106118
timeout_secs=40 * 60) # FIXME too big
@@ -110,6 +122,7 @@ def monitor_upgrade(*, ip):
110122
"'DISPATCH: NEW PHASE: Completing installation'",
111123
"/tmp/install-log"],
112124
check=False, simple_output=False,
125+
options=SSHOPTS,
113126
).returncode == 0,
114127
"Wait for rpm installation to succeed",
115128
timeout_secs=40 * 60) # FIXME too big
@@ -119,12 +132,14 @@ def monitor_upgrade(*, ip):
119132
"'The installation completed successfully'",
120133
"/tmp/install-log"],
121134
check=False, simple_output=False,
135+
options=SSHOPTS,
122136
).returncode == 0,
123137
"Wait for system installation to succeed",
124138
timeout_secs=40 * 60) # FIXME too big
125139

126140
wait_for(lambda: ssh(ip, ["ps a|grep '[0-9]. python /opt/xensource/installer/init'"],
127141
check=False, simple_output=False,
142+
options=SSHOPTS,
128143
).returncode == 1,
129144
"Wait for installer to terminate")
130145

@@ -134,6 +149,7 @@ def monitor_restore(*, ip):
134149
"'Restoring backup'",
135150
"/tmp/install-log"],
136151
check=False, simple_output=False,
152+
options=SSHOPTS,
137153
).returncode == 0,
138154
"Wait for data restoration to start",
139155
timeout_secs=40 * 60) # FIXME too big
@@ -143,6 +159,7 @@ def monitor_restore(*, ip):
143159
"'Data restoration complete. About to re-install bootloader.'",
144160
"/tmp/install-log"],
145161
check=False, simple_output=False,
162+
options=SSHOPTS,
146163
).returncode == 0,
147164
"Wait for data restoration to complete",
148165
timeout_secs=40 * 60) # FIXME too big
@@ -154,6 +171,7 @@ def monitor_restore(*, ip):
154171
"'ran .*swaplabel.*rc 0'",
155172
"/tmp/install-log"],
156173
check=False, simple_output=False,
174+
options=SSHOPTS,
157175
).returncode == 0,
158176
"Wait for installer to hopefully finish",
159177
timeout_secs=40 * 60) # FIXME too big

Diff for: tests/install/conftest.py

+3
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ def remastered_iso(installer_iso, answerfile):
161161
set -ex
162162
INSTALLIMG="$1"
163163
164+
# bad permissions in XS 6.5 preventing ssh to use authorized_keys
165+
chmod g-w "$INSTALLIMG/root"
166+
164167
mkdir -p "$INSTALLIMG/root/.ssh"
165168
echo "{TEST_SSH_PUBKEY}" > "$INSTALLIMG/root/.ssh/authorized_keys"
166169

Diff for: tests/install/test.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class TestNested:
3030
"821.1",
3131
"81", "80", "76", "75",
3232
"xs8", "ch821.1",
33-
"xs70",
33+
"xs70", "xs65",
3434
))
3535
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
3636
@pytest.mark.vm_definitions(
@@ -105,7 +105,7 @@ def helper_vm_with_plugged_disk(running_vm, create_vms):
105105
"81", "80",
106106
"76", "75",
107107
"ch821.1", "xs8",
108-
"xs70",
108+
"xs70", "xs65",
109109
))
110110
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
111111
@pytest.mark.continuation_of(
@@ -175,6 +175,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT'):
175175
"xs8": "8.4.0",
176176
"ch821.1": "8.2.1",
177177
"xs70": "7.0.0-125380c",
178+
"xs65": "6.5.0-90233c",
178179
}[expected_rel_id]
179180

180181
try:
@@ -210,7 +211,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT'):
210211
]
211212
STAMPS_DIR = "/var/lib/misc"
212213
STAMPS = [f"ran-{service}" for service in SERVICES]
213-
elif lsb_rel in ["7.0.0-125380c", "7.5.0", "7.6.0", "8.0.0", "8.1.0"]:
214+
elif lsb_rel in ["6.5.0", "7.0.0-125380c", "7.5.0", "7.6.0", "8.0.0", "8.1.0"]:
214215
SERVICES = ["xs-firstboot"]
215216
STAMPS_DIR = "/etc/firstboot.d/state"
216217
STAMPS = [
@@ -296,7 +297,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT'):
296297
"81", "80",
297298
"76", "75",
298299
"ch821.1", "xs8",
299-
"xs70",
300+
"xs70", "xs65",
300301
))
301302
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
302303
@pytest.mark.continuation_of(

0 commit comments

Comments
 (0)