Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Add a --force flag to force deletion #523

Merged
merged 1 commit into from
Apr 26, 2019

Conversation

silvin-lubecki
Copy link
Contributor

- What I did
When the uninstall action will always fail, the new --force flag will delete the installation in the installation store.

- A picture of a cute animal (not mandatory but encouraged)

image

@codecov
Copy link

codecov bot commented Apr 24, 2019

Codecov Report

Merging #523 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #523   +/-   ##
=======================================
  Coverage   69.35%   69.35%           
=======================================
  Files          55       55           
  Lines        2973     2973           
=======================================
  Hits         2062     2062           
  Misses        627      627           
  Partials      284      284

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb2effa...3f98389. Read the comment docs.

Copy link
Member

@chris-crone chris-crone left a comment

Choose a reason for hiding this comment

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

LGTM with comment change

@silvin-lubecki
Copy link
Contributor Author

PTAL @ijc

Copy link
Contributor

@ijc ijc left a comment

Choose a reason for hiding this comment

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

Code looks good, I had one minor comment on the error output.

Can we e2e test this somehow? Do we have a way to provoke a normal uninstall failure?

if err := installationStore.Delete(installationName); err != nil {
fmt.Fprintf(os.Stderr, "failed to force deletion of installation %q: %s\n", installationName, err)
}
fmt.Fprintf(os.Stderr, "deletion forced for installation %q\n", installationName)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the ordering of these two messages will be backwards in the case where they are both printed:

failed to force deletion of installation "foo": something went wrong
deletion forced for installation "foo"

I think you should move this second print up so the output would be:

deletion forced for installation "foo"
failed to force deletion of installation "foo": something went wrong

Should we also log mainErr or does that already happen e.g. in the caller?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we hit this path should we also print something along the lines "some additional manual cleanup may be required"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in the case where they are both printed:

You are right about the 2 messages, but I guess is case of failure I should just return and never print "deletion forced...".

Should we also log mainErr or does that already happen e.g. in the caller?

mainErr is handled by cobra afterwards, as we are running a RunE 👍

If we hit this path should we also print something along the lines "some additional manual cleanup may be required"?

I don't know about that, because it may be a privilege issue, so maybe the user needs to be root and retry. I let the user figure why it fails, as we print the error too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we e2e test this somehow? Do we have a way to provoke a normal uninstall failure?

I'll do that in a followup 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right about the 2 messages, but I guess is case of failure I should just return and never print "deletion forced...".

SGTM.

I'll do that in a followup

Ack

… when the uninstall action repeatedly fails.

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
@silvin-lubecki silvin-lubecki merged commit ab9036b into docker:master Apr 26, 2019
@silvin-lubecki silvin-lubecki deleted the force-deletion branch April 26, 2019 11:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants