manifest: don't add hostname stage if not specified

Skip the hostname stage if the hostname option is an empty string.
This commit is contained in:
Achilleas Koutsou 2022-10-28 19:54:12 +02:00 committed by Christian Kellner
parent 0c6bbc6dff
commit 89202bdda8

View file

@ -254,7 +254,9 @@ func (p *OS) serialize() osbuild.Pipeline {
pipeline.AddStage(osbuild.NewKeymapStage(&osbuild.KeymapStageOptions{Keymap: *p.Keyboard}))
}
pipeline.AddStage(osbuild.NewHostnameStage(&osbuild.HostnameStageOptions{Hostname: p.Hostname}))
if p.Hostname != "" {
pipeline.AddStage(osbuild.NewHostnameStage(&osbuild.HostnameStageOptions{Hostname: p.Hostname}))
}
pipeline.AddStage(osbuild.NewTimezoneStage(&osbuild.TimezoneStageOptions{Zone: p.Timezone}))
if len(p.NTPServers) > 0 {