weldr: allow running on unsupported distros

When the host distribution is not known or supported, instead of failing
with an error, print a warning to the log and initialise the API with
the architecture name and distro name.
This enables running the weldr API on unsupported distros for
cross-distro building.

Guards against a nil arch member when initialising the store.
This commit is contained in:
Achilleas Koutsou 2022-03-09 18:48:18 +01:00 committed by Tom Gundersen
parent 3ab2725042
commit f9eb98b14d
2 changed files with 28 additions and 17 deletions

View file

@ -378,6 +378,9 @@ func imageTypeToCompatString(imgType distro.ImageType) string {
}
func imageTypeFromCompatString(input string, arch distro.Arch) distro.ImageType {
if arch == nil {
return nil
}
for k, v := range imageTypeCompatMapping {
if v == input {
imgType, err := arch.GetImageType(k)