Skip to content
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

system prune: only warn for volumes if --volumes is given #255

Merged
merged 1 commit into from
Jun 29, 2017

Conversation

albers
Copy link
Collaborator

@albers albers commented Jun 27, 2017

#118 changed docker system prune to only remove volumes if --volumes is given.
The warning message, however, still always warns about volume removal:

$ docker system prune
WARNING! This will remove:
        - all stopped containers
        - all volumes not used by at least one container
        - all networks not used by at least one container
        - all dangling images
        - all build cache
Are you sure you want to continue? [y/N]

The warning message in the above example is wrong: no volumes will be deleted.

With this PR, the volume removal warning is included selectively depending on whether --volumes is given or not.

@codecov-io
Copy link

codecov-io commented Jun 27, 2017

Codecov Report

Merging #255 into master will increase coverage by <.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #255      +/-   ##
==========================================
+ Coverage   46.84%   46.85%   +<.01%     
==========================================
  Files         172      172              
  Lines       11692    11692              
==========================================
+ Hits         5477     5478       +1     
+ Misses       5903     5902       -1     
  Partials      312      312

@mlaventure
Copy link
Contributor

mlaventure commented Jun 27, 2017

I know it's only for 2 lines, but I think a text template would be cleaner.

Something like: https://play.golang.org/p/nLs0YvRrRE

@albers albers force-pushed the system-prune-volume-warning branch 2 times, most recently from ca71856 to 6e89c02 Compare June 29, 2017 13:05
Signed-off-by: Harald Albers <github@albersweb.de>
@albers albers force-pushed the system-prune-volume-warning branch from 6e89c02 to 849b0e9 Compare June 29, 2017 13:07
@albers
Copy link
Collaborator Author

albers commented Jun 29, 2017

@mlaventure Thanks for your advice and the code sample. I pulled out message generation into a function that uses a template. PTAL.

Copy link
Contributor

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@mlaventure mlaventure left a comment

Choose a reason for hiding this comment

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

LGTM

@mlaventure mlaventure merged commit 64486d7 into docker:master Jun 29, 2017
@GordonTheTurtle GordonTheTurtle added this to the 17.07.0 milestone Jun 29, 2017
@thaJeztah thaJeztah modified the milestones: 17.06.1, 17.07.0 Jun 30, 2017
@albers albers deleted the system-prune-volume-warning branch June 30, 2017 09:46
@thaJeztah thaJeztah modified the milestones: 17.06.1, 17.07.0 Jul 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants