55from lib .commands import ssh , SSHCommandFailed
66from 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+
814class AnswerFile :
915 def __init__ (self , kind , / ):
1016 from data import BASE_ANSWERFILES
@@ -62,7 +68,7 @@ def _defn_to_xml_et(defn, /, *, parent=None):
6268
6369def poweroff (ip ):
6470 try :
65- ssh (ip , ["poweroff" ])
71+ ssh (ip , ["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 :
@@ -77,6 +83,7 @@ def monitor_install(*, ip):
7783 "'DISPATCH: NEW PHASE: Completing installation'" ,
7884 "/tmp/install-log" ],
7985 check = False , simple_output = False ,
86+ options = SSHOPTS ,
8087 ).returncode == 0 ,
8188 "Wait for rpm installation to succeed" ,
8289 timeout_secs = 40 * 60 ) # FIXME too big
@@ -86,12 +93,14 @@ def monitor_install(*, ip):
8693 "'The installation completed successfully'" ,
8794 "/tmp/install-log" ],
8895 check = False , simple_output = False ,
96+ options = SSHOPTS ,
8997 ).returncode == 0 ,
9098 "Wait for system installation to succeed" ,
9199 timeout_secs = 40 * 60 ) # FIXME too big
92100
93101 wait_for (lambda : ssh (ip , ["ps a|grep '[0-9]. python /opt/xensource/installer/init'" ],
94102 check = False , simple_output = False ,
103+ options = SSHOPTS ,
95104 ).returncode == 1 ,
96105 "Wait for installer to terminate" )
97106
@@ -101,6 +110,7 @@ def monitor_upgrade(*, ip):
101110 "'DISPATCH: NEW PHASE: Reading package information'" ,
102111 "/tmp/install-log" ],
103112 check = False , simple_output = False ,
113+ options = SSHOPTS ,
104114 ).returncode == 0 ,
105115 "Wait for upgrade preparations to finish" ,
106116 timeout_secs = 40 * 60 ) # FIXME too big
@@ -110,6 +120,7 @@ def monitor_upgrade(*, ip):
110120 "'DISPATCH: NEW PHASE: Completing installation'" ,
111121 "/tmp/install-log" ],
112122 check = False , simple_output = False ,
123+ options = SSHOPTS ,
113124 ).returncode == 0 ,
114125 "Wait for rpm installation to succeed" ,
115126 timeout_secs = 40 * 60 ) # FIXME too big
@@ -119,12 +130,14 @@ def monitor_upgrade(*, ip):
119130 "'The installation completed successfully'" ,
120131 "/tmp/install-log" ],
121132 check = False , simple_output = False ,
133+ options = SSHOPTS ,
122134 ).returncode == 0 ,
123135 "Wait for system installation to succeed" ,
124136 timeout_secs = 40 * 60 ) # FIXME too big
125137
126138 wait_for (lambda : ssh (ip , ["ps a|grep '[0-9]. python /opt/xensource/installer/init'" ],
127139 check = False , simple_output = False ,
140+ options = SSHOPTS ,
128141 ).returncode == 1 ,
129142 "Wait for installer to terminate" )
130143
@@ -134,6 +147,7 @@ def monitor_restore(*, ip):
134147 "'Restoring backup'" ,
135148 "/tmp/install-log" ],
136149 check = False , simple_output = False ,
150+ options = SSHOPTS ,
137151 ).returncode == 0 ,
138152 "Wait for data restoration to start" ,
139153 timeout_secs = 40 * 60 ) # FIXME too big
@@ -143,6 +157,7 @@ def monitor_restore(*, ip):
143157 "'Data restoration complete. About to re-install bootloader.'" ,
144158 "/tmp/install-log" ],
145159 check = False , simple_output = False ,
160+ options = SSHOPTS ,
146161 ).returncode == 0 ,
147162 "Wait for data restoration to complete" ,
148163 timeout_secs = 40 * 60 ) # FIXME too big
@@ -154,6 +169,7 @@ def monitor_restore(*, ip):
154169 "'ran .*swaplabel.*rc 0'" ,
155170 "/tmp/install-log" ],
156171 check = False , simple_output = False ,
172+ options = SSHOPTS ,
157173 ).returncode == 0 ,
158174 "Wait for installer to hopefully finish" ,
159175 timeout_secs = 40 * 60 ) # FIXME too big
0 commit comments