Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #161 from digeler/digeler/helm-2to3-pr080820
Browse files Browse the repository at this point in the history
adding skip-confirmation flag to move config - fix to 158
  • Loading branch information
hickeyma authored Sep 24, 2020
2 parents 8b2722b + 62b6688 commit a401afd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ $ helm 2to3 move config [flags]
Flags:

--dry-run simulate a command
--skip-confirmation if set, skips confirmation message before performing move
-h, --help help for move
```

Expand Down
20 changes: 14 additions & 6 deletions cmd/move_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func newMoveConfigCmd(out io.Writer) *cobra.Command {

flags := cmd.Flags()
settings.AddBaseFlags(flags)

flags.BoolVar(&skipConfirmation, "skip-confirmation", false, "if set, skips confirmation message before performing move")
return cmd
}

Expand All @@ -58,6 +58,8 @@ func runMove(cmd *cobra.Command, args []string) error {
// Moves/copies v2 configuration to v2 configuration. It copies repository config,
// plugins and starters. It does not copy cache.
func Move(dryRun bool) error {
var err error
var doConfig bool
if dryRun {
log.Println("NOTE: This is in dry-run mode, the following actions will not be executed.")
log.Println("Run without --dry-run to take the actions described below:")
Expand All @@ -66,12 +68,18 @@ func Move(dryRun bool) error {

log.Println("WARNING: Helm v3 configuration may be overwritten during this operation.")
log.Println()
doCleanup, err := utils.AskConfirmation("Move Config", "move the v2 configuration")
if err != nil {
return err
if skipConfirmation {

log.Println("Skipping confirmation before performing move configuration.")
doConfig = true
} else {
doConfig, err = utils.AskConfirmation("Move config", "move the v2 configuration")
if err != nil {
return err
}
}
if !doCleanup {
log.Println("Move configuration will not proceed as the user didn't answer (Y|y) in order to continue.")
if !doConfig {
log.Println("Move will not proceed as the user didn't answer (Y|y) in order to continue.")
return nil
}

Expand Down
1 change: 1 addition & 0 deletions completion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ commands:
- name: config
flags:
- dry-run
- skip-confirmation
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "2to3"
version: "0.6.0"
version: "0.7.0"
usage: "migrate and cleanup Helm v2 configuration and releases in-place to Helm v3"
description: "migrate and cleanup Helm v2 configuration and releases in-place to Helm v3"
command: "$HELM_PLUGIN_DIR/bin/2to3"
Expand Down

0 comments on commit a401afd

Please sign in to comment.