Skip to content

Commit

Permalink
Fixing the pipelines
Browse files Browse the repository at this point in the history
Signed-off-by: Yashvi Jain <yashvi.jain@progress.com>
  • Loading branch information
Yashvi Jain committed Jan 3, 2023
1 parent e754f52 commit f2b0df5
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions components/automate-cli/cmd/chef-automate/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ func runDeleteBackupCmd(cmd *cobra.Command, args []string) error {
start := 0
var validIds []string
var backup []*api.BackupTask

if strings.Contains(args[0], "/") || strings.Contains(args[0], "\\") {
location = args[0]
start = 1
Expand All @@ -821,23 +821,24 @@ func runDeleteBackupCmd(cmd *cobra.Command, args []string) error {
}
}

if !backupDeleteCmdFlags.yes && len(validIds) > 0 {
if len(validIds) > 0 {
if !backupDeleteCmdFlags.yes {
yes, err := writer.Confirm(
fmt.Sprintf("The following backups will be permanently deleted:\n%s\nAre you sure you want to continue?",
strings.Join(validIds, "\n"),
),
)
if err != nil {
return status.Annotate(err, status.BackupError)
}
if !yes {
return status.New(status.InvalidCommandArgsError, "failed to confirm backup deletion")
}
}
ids, err := idsToBackupTasks(validIds)
if err != nil {
return err
}
yes, err := writer.Confirm(
fmt.Sprintf("The following backups will be permanently deleted:\n%s\nAre you sure you want to continue?",
strings.Join(validIds, "\n"),
),
)
if err != nil {
return status.Annotate(err, status.BackupError)
}
if !yes {
return status.New(status.InvalidCommandArgsError, "failed to confirm backup deletion")
}

_, err = client.DeleteBackups(
time.Duration(backupCmdFlags.requestTimeout)*time.Second,
time.Duration(backupCmdFlags.deleteWaitTimeout)*time.Second,
Expand All @@ -848,7 +849,6 @@ func runDeleteBackupCmd(cmd *cobra.Command, args []string) error {
}
writer.Success("Backups deleted")
}

return nil
}

Expand Down

0 comments on commit f2b0df5

Please sign in to comment.