From dbadd42a01bb568b73e0c72d52b80226af2dfc1b Mon Sep 17 00:00:00 2001 From: Irene Diez Date: Fri, 10 Feb 2023 14:42:31 +0100 Subject: [PATCH] distro/rhel8+9: deprecate User/Group customi. on edge-commit/container Signed-off-by: Irene Diez --- internal/distro/rhel8/imagetype.go | 12 ++++++++++++ internal/distro/rhel9/imagetype.go | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/internal/distro/rhel8/imagetype.go b/internal/distro/rhel8/imagetype.go index 6efa022d7..833ef0595 100644 --- a/internal/distro/rhel8/imagetype.go +++ b/internal/distro/rhel8/imagetype.go @@ -2,6 +2,7 @@ package rhel8 import ( "fmt" + "log" "math/rand" "strings" @@ -402,6 +403,17 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio return fmt.Errorf("edge raw images require specifying a URL from which to retrieve the OSTree commit") } + // warn that user & group customizations on edge-commit, edge-container are deprecated + // TODO(edge): directly error if these options are provided when rhel-9.5's time arrives + if t.name == "edge-commit" || t.name == "edge-container" { + if customizations.GetUsers() != nil { + log.Printf("Please note that user customizations on %q image type are deprecated and will be removed in the near future\n", t.name) + } + if customizations.GetGroups() != nil { + log.Printf("Please note that group customizations on %q image type are deprecated and will be removed in the near future\n", t.name) + } + } + if kernelOpts := customizations.GetKernel(); kernelOpts.Append != "" && t.rpmOstree && (!t.bootable || t.bootISO) { return fmt.Errorf("kernel boot parameter customizations are not supported for ostree types") } diff --git a/internal/distro/rhel9/imagetype.go b/internal/distro/rhel9/imagetype.go index dcf653d74..c5654c1a2 100644 --- a/internal/distro/rhel9/imagetype.go +++ b/internal/distro/rhel9/imagetype.go @@ -2,6 +2,7 @@ package rhel9 import ( "fmt" + "log" "math/rand" "strings" @@ -382,6 +383,17 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio return fmt.Errorf("edge raw images require specifying a URL from which to retrieve the OSTree commit") } + // warn that user & group customizations on edge-commit, edge-container are deprecated + // TODO(edge): directly error if these options are provided when rhel-9.5's time arrives + if t.name == "edge-commit" || t.name == "edge-container" { + if customizations.GetUsers() != nil { + log.Printf("Please note that user customizations on %q image type are deprecated and will be removed in the near future\n", t.name) + } + if customizations.GetGroups() != nil { + log.Printf("Please note that group customizations on %q image type are deprecated and will be removed in the near future\n", t.name) + } + } + if kernelOpts := customizations.GetKernel(); kernelOpts.Append != "" && t.rpmOstree && t.name != "edge-raw-image" && t.name != "edge-simplified-installer" { return fmt.Errorf("kernel boot parameter customizations are not supported for ostree types") }