Skip to content

Commit

Permalink
Merge pull request cozy#1133 from nono/ask-fqdn-on-instances-rm
Browse files Browse the repository at this point in the history
Ask domain to confirm an instance destroy
  • Loading branch information
jinroh authored Jan 2, 2018
2 parents d4776bd + 2d7d241 commit dd14dec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,18 @@ and all its data.

if !flagForce {
reader := bufio.NewReader(os.Stdin)
fmt.Printf(`Are you sure you want to remove instance for domain %s ?
fmt.Printf(`Are you sure you want to remove instance for domain %s?
All data associated with this domain will be permanently lost.
[yes/NO]: `, domain)
Type again the domain to confirm: `, domain)

str, err := reader.ReadString('\n')
if err != nil {
return err
}

str = strings.ToLower(strings.TrimSpace(str))
if str != "yes" && str != "y" {
return nil
if str != domain {
return errors.New("Aborted")
}

fmt.Println()
Expand Down

0 comments on commit dd14dec

Please sign in to comment.