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

Conversation

surajnarwade
Copy link
Contributor

Fixes #204

@surajnarwade surajnarwade changed the title Application Deletion will show what will be deleted [WIP] Application Deletion will show what will be deleted Mar 27, 2018
@surajnarwade surajnarwade force-pushed the app-del branch 2 times, most recently from d14ea39 to c32b030 Compare March 28, 2018 09:11
@surajnarwade
Copy link
Contributor Author

@containscafeine @kadel , review needed :)

@surajnarwade surajnarwade changed the title [WIP] Application Deletion will show what will be deleted Application Deletion will show what will be deleted Mar 28, 2018
@surajnarwade surajnarwade requested a review from concaf March 28, 2018 13:16
@concaf
Copy link
Contributor

concaf commented Mar 28, 2018

So, we need to see this before asking for the confirmation, not after that.
Currently,

$ ocdev application delete app5
Are you sure you want to delete the application: app5? [y/N] y
Component nodejs will be deleted:
This component is not externally exposed
This component used storage and it will be removed
Component nodejs2 will be deleted:
This component is not externally exposed
This component used storage and it will be removed
Component nodejs3 will be deleted:
This component is not externally exposed
This component used storage and it will be removed
Component nodejs4 will be deleted:
This component is not externally exposed
This component used storage and it will be removed
Component nodejs5 will be deleted:
This component is not externally exposed
This component used storage and it will be removed
Deleted application: app5

@concaf
Copy link
Contributor

concaf commented Mar 28, 2018

Also, my nodejs component did not use any storage, it should not the message.
We also need to print the storage name if it's being used

@surajnarwade
Copy link
Contributor Author

@containscafeine when I run,

 $ ocdev storage list
deploymentconfigs/nodejs

I didn't get this

@surajnarwade
Copy link
Contributor Author

surajnarwade commented Mar 29, 2018

I have updated code in such way that it will show information before confirmation

cmd/utils.go Outdated
"github.com/redhat-developer/ocdev/pkg/url"
)

func printRequiredInfo(appName string, client *occlient.Client) error {
Copy link
Member

Choose a reason for hiding this comment

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

This output is specific to delete operation. It might be good to indicate that in the function name
How about printDeleteAppInfo

also in all other functions, we are taking client as the first argument, it would be good to stick to that convention

and comment for that function wouldn't hurt either ;-)

@surajnarwade
Copy link
Contributor Author

@kadel @containscafeine one more review needed :)

cmd/utils.go Outdated
if len(appUrl) != 0 {
fmt.Println("This component is externally exposed, and the URL will be removed")
} else {
fmt.Println("This component is not externally exposed")
Copy link
Member

Choose a reason for hiding this comment

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

it might be better to not show anything. To make it consistent with how we display storage.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@@ -94,6 +94,11 @@ var applicationDeleteCmd = &cobra.Command{
if applicationForceDeleteFlag {
confirmDeletion = "y"
} else {
err := printDeleteAppInfo(client, appName)
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be before the if statement

cmd/utils.go Outdated
func printDeleteAppInfo(client *occlient.Client, appName string) error {
componentList, err := component.List(client)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

let's wrap the error

cmd/utils.go Outdated
fmt.Println("Component", cmpnt.Name, "will be deleted:")
appUrl, err := url.List(client, cmpnt.Name, appName)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

wrap

cmd/utils.go Outdated
fmt.Println("This component is not externally exposed")

}
appStore, _ := storage.List(client, &occlient.VolumeConfig{
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we ignoring the error here?

Copy link
Member

@kadel kadel Apr 5, 2018

Choose a reason for hiding this comment

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

good catch @containscafeine

cmd/utils.go Outdated
fmt.Println("This component is not externally exposed")

}
appStore, _ := storage.List(client, &occlient.VolumeConfig{
Copy link
Member

@kadel kadel Apr 5, 2018

Choose a reason for hiding this comment

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

good catch @containscafeine

@surajnarwade surajnarwade force-pushed the app-del branch 2 times, most recently from 2899b71 to bc611b1 Compare April 9, 2018 12:39
@surajnarwade
Copy link
Contributor Author

@kadel done with requested changes

@@ -75,6 +75,13 @@ var applicationDeleteCmd = &cobra.Command{
appName := args[0]
var confirmDeletion string

// Print App Information which will be deleted
err := printDeleteAppInfo(client, appName)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

you can replace with
checkError(err, "")

cmd/utils.go Outdated
if len(appUrl) != 0 {
fmt.Println("This component is externally exposed, and the URL will be removed")
}
appStore, err := storage.List(client, &occlient.VolumeConfig{
Copy link
Member

Choose a reason for hiding this comment

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

#295 changes storage.List, should we wait for that PR?
Or changing this will be handled in #295

#295 is already big PR, so it might make sense to wait for it.
What do you think @surajnarwade @containscafeine ?

@kadel kadel added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label Apr 10, 2018
@kadel
Copy link
Member

kadel commented Apr 10, 2018

currently this is blocked on #295

@concaf
Copy link
Contributor

concaf commented Apr 10, 2018

blocked on #287

@kadel kadel added the status/blocked Denotes an issue or PR that is blocked on something (e.g., issue/PR in different repo) label Apr 10, 2018
@surajnarwade surajnarwade force-pushed the app-del branch 2 times, most recently from 6736e56 to 133df8d Compare April 17, 2018 13:51
@surajnarwade surajnarwade removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. status/blocked Denotes an issue or PR that is blocked on something (e.g., issue/PR in different repo) labels Apr 17, 2018
// 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.

@concaf
Copy link
Contributor

concaf commented Apr 19, 2018

@surajnarwade how about -

Deleting the component 'nodejs' will delete the following resources:
<print component info>
Do you want to delete? (y/N)

cmd/utils.go Outdated
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")
Copy link
Member

Choose a reason for hiding this comment

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

can we add two spaces to the beginning of the line to indicate that this is related to the component mentioned above?

cmd/utils.go Outdated
}

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

Choose a reason for hiding this comment

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

can we add two spaces to the beginning of the line to indicate that this is related to the component mentioned above?

cmd/utils.go Outdated
if err != nil {
return errors.Wrap(err, "unable to get component description")
}
fmt.Println("Component", cmpnt.Name, "will be deleted:")
Copy link
Member

Choose a reason for hiding this comment

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

The ":" looks strange when the component doesn't have any URLs or storages.

▶ odo app delete app
Component backend will be deleted:
Component frontend will be deleted:
This component is externally exposed, and the URL will be removed
Are you sure you want to delete the application: app? [y/N]

This looks better:

▶ odo app delete app
Component backend will be deleted.
Component frontend will be deleted.
  This component is externally exposed, and the URL will be removed
Are you sure you want to delete the application: app? [y/N]

@surajnarwade surajnarwade force-pushed the app-del branch 2 times, most recently from fc69ace to dfb0b7d Compare April 20, 2018 13:13
@kadel
Copy link
Member

kadel commented Apr 23, 2018

ping @containscafeine

@concaf concaf merged commit 8f7073c into redhat-developer:master Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants