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

@@ -25,12 +25,18 @@ func GetCommand() *cobra.Command {
supported by the current version.`,
RunE: UpgradeNodesConf,
}
command.Flags().StringVarP(&inputPath, "input-path", "i", config.ConfigFile, "Path to a legacy warewulf.conf")
command.Flags().StringVarP(&outputPath, "output-path", "o", config.ConfigFile, "Path to write the upgraded warewulf.conf to")
command.Flags().StringVarP(&inputPath, "input-path", "i", "", "Path to a legacy warewulf.conf")
command.Flags().StringVarP(&outputPath, "output-path", "o", "", "Path to write the upgraded warewulf.conf to")
return command
}
func UpgradeNodesConf(cmd *cobra.Command, args []string) error {
if inputPath == "" {
inputPath = config.ConfigFile
}
if outputPath == "" {
outputPath = config.ConfigFile
}
data, err := os.ReadFile(inputPath)
if err != nil {
return err