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

Commit

Permalink
first spike of cleanup tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Jul 27, 2017
1 parent 8f0805a commit 0e7b1bc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
32 changes: 32 additions & 0 deletions cmds/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,38 @@ func NewCmdCleanUpApp(f *cmdutil.Factory) *cobra.Command {
return cmd
}

func NewCmdCleanUpTenant(f *cmdutil.Factory) *cobra.Command {
cmd := &cobra.Command{
Use: "tenant",
Short: "Hard delete your tenant removing all pipelines, apps, jobs and releases",

Run: func(cmd *cobra.Command, args []string) {
var confirm string
if cmd.Flags().Lookup(yesFlag).Value.String() == "true" {
confirm = "y"
} else {
fmt.Fprintf(os.Stdout, `WARNING this is destructive and will remove all your pipelines, apps, jobs and releases. Continue? [y/N] `)
fmt.Scanln(&confirm)
}

if confirm == "y" {
util.Info("Removing all tenant pipelines...\n")
err := cleanUpTenant(f)
if err != nil {
util.Fatalf("Failed to remove tenant %v", err)
}
return
}
util.Info("Cancelled")
},
}
return cmd
}

func cleanUpTenant(f *cmdutil.Factory) error {
return nil
}

func deleteSystem(f *cmdutil.Factory) error {
var oc *oclient.Client

Expand Down
4 changes: 2 additions & 2 deletions cmds/environ.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ func createEnviron(cmd *cobra.Command, args []string, detectedNS string, c *k8cl
// NewCmdDeleteEnviron is a command to delete an environ using: gofabric8 delete environ abcd
func NewCmdDeleteEnviron(f *cmdutil.Factory) *cobra.Command {
cmd := &cobra.Command{
Use: "environ",
Use: "env",
Short: "Delete environment from fabric8-environments configmap",
Aliases: []string{"env"},
Aliases: []string{"environ", "enviroment"},
Run: func(cmd *cobra.Command, args []string) {
wp := cmd.Flags().Lookup("work-project").Value.String()
detectedNS, c, _ := getOpenShiftClient(f, wp)
Expand Down

0 comments on commit 0e7b1bc

Please sign in to comment.