Merge pull request #1684 from anderbubble/upgrade-no-backup
Don't attempt to back-up an output file that doesn't exist during upgrade
This commit is contained in:
@@ -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