image: panic if unknown compression option is specified

Currently we only support "xz", but keeping it as a `switch` to easily
support more types in the future.
The empty string is also supported as a no-op.
This commit is contained in:
Achilleas Koutsou 2022-11-25 16:20:56 +01:00 committed by Christian Kellner
parent 6374ec022d
commit b3f4d75699

View file

@ -1,6 +1,7 @@
package image
import (
"fmt"
"math/rand"
"github.com/osbuild/osbuild-composer/internal/artifact"
@ -99,6 +100,11 @@ func (img *LiveImage) InstantiateManifest(m *manifest.Manifest,
xzPipeline := manifest.NewXZ(m, buildPipeline, artifactPipeline)
xzPipeline.Filename = img.Filename
artifact = xzPipeline.Export()
case "":
// do nothing
default:
// panic on unknown strings
panic(fmt.Sprintf("unsupported compression type %q", img.Compression))
}
return artifact, nil