cmdlib: only require kvm for building
We should be able to `cosa init` and `cosa buildprep` without requiring
KVM. For example, in the FCOS pipeline, we do this when running kola
against various clouds.
@@ -102,6 +102,12 @@ preflight() {
fatal "Your umask is unset, please use umask 0022 or so"
fi
+ if ! has_privileges && [ -n "${ISEL}" ]; then
+ fatal "running on EL requires privileged mode"
+ fi
+}
+
+preflight_kvm() {
# permissions on /dev/kvm vary by (host) distro. If it's
# not writable, recreate it.
@@ -119,10 +125,6 @@ preflight() {
fi
fi
fi
-
- if ! has_privileges && [ -n "${ISEL}" ]; then
- fatal "running on EL requires privileged mode"
- fi
}
# Picks between yaml or json based on which version exists. Errors out if both
@@ -143,6 +145,7 @@ pick_yaml_or_else_json() {
prepare_build() {
preflight
+ preflight_kvm
if ! [ -d builds ]; then
fatal "No $(pwd)/builds found; did you run coreos-assembler init?"
fi
