Use configured warewulf.conf path in wwctl upgrade

- Fixes: #1658

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-01-30 10:52:29 -07:00
parent 20c3b3db23
commit 736f9dae48
4 changed files with 25 additions and 13 deletions

View File

@@ -32,7 +32,7 @@ supported by the current version.`,
command.Flags().BoolVar(&replaceOverlays, "replace-overlays", false, "Replace 'wwinit' and 'generic' overlays with their split replacements")
command.Flags().StringVarP(&inputPath, "input-path", "i", "", "Path to a legacy nodes.conf")
command.Flags().StringVarP(&outputPath, "output-path", "o", "", "Path to write the upgraded nodes.conf to")
command.Flags().StringVar(&inputConfPath, "with-warewulfconf", config.ConfigFile, "Path to a legacy warewulf.conf")
command.Flags().StringVar(&inputConfPath, "with-warewulfconf", "", "Path to a legacy warewulf.conf")
if err := command.MarkFlagRequired("add-defaults"); err != nil {
panic(err)
}
@@ -51,6 +51,9 @@ func UpgradeNodesConf(cmd *cobra.Command, args []string) error {
if outputPath == "" {
outputPath = config.Get().Paths.NodesConf()
}
if inputConfPath == "" {
inputConfPath = config.ConfigFile
}
confData, err := os.ReadFile(inputConfPath)
if err != nil {