Rename "container" to "image"
- Updated `wwctl upgrade` to handle updates - Maintained `.Container` and `.ContainerName` in tstruct - Added `ContainerName()` methods to node and profile objects - Added `--container`, `-C` aliases to wwctl commands (`<node|profile> <add|set>`) - Added `wwctl container` alias - Added support for `container_exit.sh` if `image_exit.sh` is not found Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
40
internal/app/wwctl/image/syncuser/main.go
Normal file
40
internal/app/wwctl/image/syncuser/main.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package syncuser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
image_build "github.com/warewulf/warewulf/internal/pkg/api/image"
|
||||
"github.com/warewulf/warewulf/internal/pkg/api/routes/wwapiv1"
|
||||
"github.com/warewulf/warewulf/internal/pkg/image"
|
||||
"github.com/warewulf/warewulf/internal/pkg/wwlog"
|
||||
)
|
||||
|
||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
imageName := args[0]
|
||||
if !image.ValidName(imageName) {
|
||||
return fmt.Errorf("%s is not a valid image", imageName)
|
||||
}
|
||||
err := image.SyncUids(imageName, write)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error in synchronize: %s", err)
|
||||
}
|
||||
|
||||
if write && !build {
|
||||
// when write = true and build = false, we will print a warnning, this is the default case
|
||||
wwlog.Warn("Syncuser is completed, please remember to rebuild image or add `--build` flag for automatic rebuild after syncuser")
|
||||
} else if write && build {
|
||||
// if write = true and build = true, then it'll trigger the image build after sync
|
||||
cbp := &wwapiv1.ImageBuildParameter{
|
||||
ImageNames: []string{imageName},
|
||||
Force: true,
|
||||
All: false,
|
||||
}
|
||||
err := image_build.ImageBuild(cbp)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error during image build: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user