Merge pull request #1404 from JasonYangShadow/issue/1378
Add flag --build to wwctl container copy, default false
This commit is contained in:
@@ -18,6 +18,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
||||
cdp := &wwapiv1.ContainerCopyParameter{
|
||||
ContainerSource: args[0],
|
||||
ContainerDestination: args[1],
|
||||
Build: Build,
|
||||
}
|
||||
|
||||
if !container.DoesSourceExist(cdp.ContainerSource) {
|
||||
@@ -37,6 +38,13 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
||||
return fmt.Errorf("could not duplicate image: %s", err.Error())
|
||||
}
|
||||
|
||||
if cdp.Build {
|
||||
err = container.Build(cdp.ContainerDestination, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
wwlog.Info("Container %s successfully duplicated as %s", cdp.ContainerSource, cdp.ContainerDestination)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user