Skip to content

Application Deletion will show what will be deleted #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ var applicationDeleteCmd = &cobra.Command{
client := getOcClient()
appName := args[0]
var confirmDeletion string
// Project
currentProject := project.GetCurrent(client)
// Print App Information which will be deleted
err := printDeleteAppInfo(client, appName, currentProject)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this reuse functions from #287?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Text content is different, so I created separate function for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkError(err, "")

if applicationForceDeleteFlag {
confirmDeletion = "y"
Expand Down
35 changes: 35 additions & 0 deletions cmd/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package cmd

import (
"fmt"

"github.com/pkg/errors"
"github.com/redhat-developer/odo/pkg/component"
"github.com/redhat-developer/odo/pkg/occlient"
)

// printDeleteAppInfo will print things which will be deleted
func printDeleteAppInfo(client *occlient.Client, appName string, currentProject string) error {
componentList, err := component.List(client, appName, currentProject)
if err != nil {
return errors.Wrap(err, "failed to get Component list")
}

for _, cmpnt := range componentList {
_, _, componentURL, appStore, err := component.GetComponentDesc(client, cmpnt.Name, appName, currentProject)
if err != nil {
return errors.Wrap(err, "unable to get component description")
}
fmt.Println("Component", cmpnt.Name, "will be deleted.")

if len(componentURL) != 0 {
fmt.Println(" This component is externally exposed, and the URL will be removed")
}

for _, store := range appStore {
fmt.Println(" This Component uses storage", store.Name, "of size", store.Size, "will be removed")
}

}
return nil
}