Don't attempt to back-up an output file that doesn't exist during upgrade
- Fixes: #1671 Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Christian Goll
parent
ff88afbf6d
commit
8b26088083
@@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Remove a redundant "Building image" log message after image exec. #1694
|
||||
- Don't populate NetDevs[].Type or NetDevs[].Netmask during upgrade. #1661
|
||||
- Prefer parent profile values over child profile values. #1672
|
||||
- Don't attempt to back-up an output file that doesn't exist during upgrade. #1671
|
||||
|
||||
## v4.6.0rc1, 2025-01-29
|
||||
|
||||
|
||||
@@ -54,8 +54,10 @@ func UpgradeNodesConf(cmd *cobra.Command, args []string) error {
|
||||
fmt.Print(string(upgradedYaml))
|
||||
return nil
|
||||
} else {
|
||||
if err := util.CopyFile(outputPath, outputPath+"-old"); err != nil {
|
||||
return err
|
||||
if util.IsFile(outputPath) {
|
||||
if err := util.CopyFile(outputPath, outputPath+"-old"); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return upgraded.PersistToFile(outputPath)
|
||||
}
|
||||
|
||||
@@ -81,8 +81,10 @@ func UpgradeNodesConf(cmd *cobra.Command, args []string) error {
|
||||
fmt.Print(string(upgradedYaml))
|
||||
return nil
|
||||
} else {
|
||||
if err := util.CopyFile(outputPath, outputPath+"-old"); err != nil {
|
||||
return err
|
||||
if util.IsFile(outputPath) {
|
||||
if err := util.CopyFile(outputPath, outputPath+"-old"); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return upgraded.PersistToFile(outputPath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user