Skip to content

Commit

Permalink
Merge pull request #3535 from pachyderm/undeploy-confirmation-check
Browse files Browse the repository at this point in the history
Undeploy confirmation check
  • Loading branch information
ysimonson committed Mar 1, 2019
2 parents 2be436a + ea65994 commit 98bf0ca
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
3 changes: 2 additions & 1 deletion src/server/cmd/pachctl/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,14 @@ This resets the cluster to its initial state.`,
for _, pi := range pipelineInfos {
pipelines = append(pipelines, red(pi.Pipeline.Name))
}
fmt.Printf("Are you sure you want to delete all ACLs, repos, commits, files, pipelines and jobs?\nyN\n")
fmt.Println("All ACLs, repos, commits, files, pipelines and jobs will be deleted.")
if len(repos) > 0 {
fmt.Printf("Repos to delete: %s\n", strings.Join(repos, ", "))
}
if len(pipelines) > 0 {
fmt.Printf("Pipelines to delete: %s\n", strings.Join(pipelines, ", "))
}
fmt.Println("Are you sure you want to do this? (y/n):")
r := bufio.NewReader(os.Stdin)
bytes, err := r.ReadBytes('\n')
if err != nil {
Expand Down
64 changes: 31 additions & 33 deletions src/server/pkg/deploy/cmds/cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,42 +673,40 @@ flag), the underlying volumes will be removed, making metadata such repos,
commits, pipelines, and jobs unrecoverable. If your persistent volume was
manually provisioned (i.e. if you used the "--static-etcd-volume" flag), the
underlying volume will not be removed.
Are you sure you want to proceed? yN
`)
r := bufio.NewReader(os.Stdin)
bytes, err := r.ReadBytes('\n')
if err != nil {
return err
}
if !(bytes[0] == 'y' || bytes[0] == 'Y') {
return nil
}
}
io := cmdutil.IO{
Stdout: os.Stdout,
Stderr: os.Stderr,
}
assets := []string{
"service",
"replicationcontroller",
"deployment",
"serviceaccount",
"secret",
"statefulset",
"clusterrole",
"clusterrolebinding",
fmt.Println("Are you sure you want to do this? (y/n):")
r := bufio.NewReader(os.Stdin)
bytes, err := r.ReadBytes('\n')
if err != nil {
return err
}
if all {
assets = append(assets, []string{
"storageclass",
"persistentvolumeclaim",
"persistentvolume",
}...)
}
for _, asset := range assets {
if err := cmdutil.RunIO(io, "kubectl", "delete", asset, "-l", "suite=pachyderm", "--namespace", namespace); err != nil {
return err
if bytes[0] == 'y' || bytes[0] == 'Y' {
io := cmdutil.IO{
Stdout: os.Stdout,
Stderr: os.Stderr,
}
assets := []string{
"service",
"replicationcontroller",
"deployment",
"serviceaccount",
"secret",
"statefulset",
"clusterrole",
"clusterrolebinding",
}
if all {
assets = append(assets, []string{
"storageclass",
"persistentvolumeclaim",
"persistentvolume",
}...)
}
for _, asset := range assets {
if err := cmdutil.RunIO(io, "kubectl", "delete", asset, "-l", "suite=pachyderm", "--namespace", namespace); err != nil {
return err
}
}
}
return nil
Expand Down

0 comments on commit 98bf0ca

Please sign in to comment.