@@ -171,12 +171,10 @@ else
171
171
abort " flake must be set"
172
172
fi
173
173
174
- # wait for machine to become reachable (possibly forever)
175
- # TODO we probably need an architecture detection here
176
- # TODO if we have specified a user here but we are already booted into the
177
- # installer, than the user might not work anymore
178
- until facts=$(
179
- ssh_ -o ConnectTimeout=10 -- << SSH
174
+ import_facts () {
175
+ local facts filtered_facts
176
+ if ! facts=$(
177
+ ssh_ -o ConnectTimeout=10 -- << SSH
180
178
set -efu ${enable_debug}
181
179
has(){
182
180
command -v "\$ 1" >/dev/null && echo "y" || echo "n"
@@ -194,13 +192,23 @@ has_wget=\$(has wget)
194
192
has_curl=\$ (has curl)
195
193
FACTS
196
194
SSH
197
- ) ; do
195
+ ) ; then
196
+ return 1
197
+ fi
198
+ filtered_facts=$( echo " $facts " | grep -E ' ^(has|is)_[a-z0-9_]+=\S+' )
199
+ if [[ -z " $filtered_facts " ]]; then
200
+ abort " Retrieving host facts via ssh failed. Check with --debug for the root cause, unless you have done so already"
201
+ fi
202
+ # make facts available in script
203
+ # shellcheck disable=SC2046
204
+ export $( echo " $filtered_facts " | xargs)
205
+ }
206
+
207
+ # wait for machine to become reachable (possibly forever)
208
+ until import_facts; do
198
209
sleep 5
199
210
done
200
211
201
- # make facts available in script
202
- # shellcheck disable=SC2046
203
- export $( echo " $facts " | grep -E ' ^(has|is)_[a-z0-9_]+=\S+' | xargs)
204
212
205
213
if [[ ${has_tar-n} == " n" ]]; then
206
214
abort " no tar command found, but required to unpack kexec tarball"
0 commit comments