-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Service cap-add/cap-drop: add special "RESET" value #2709
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2709 +/- ##
==========================================
+ Coverage 58.54% 58.56% +0.01%
==========================================
Files 296 296
Lines 21286 21294 +8
==========================================
+ Hits 12462 12470 +8
Misses 7915 7915
Partials 909 909 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bash completion LGTM.
0b463fd
to
88ed9b4
Compare
Rebased, and moved out of draft |
@@ -1522,6 +1522,28 @@ func TestUpdateCaps(t *testing.T) { | |||
expectedAdd: []string{"CAP_AAA", "CAP_BBB", "CAP_CCC", "CAP_DDD"}, | |||
expectedDrop: []string{"CAP_WWW", "CAP_XXX", "CAP_YYY", "CAP_ZZZ"}, | |||
}, | |||
{ | |||
name: "Reset capabilities", | |||
flagAdd: []string{"RESET"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add also a test with ALL
, RESET
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added two tests that combine ALL
and RESET
88ed9b4
to
0646789
Compare
This implements a special "RESET" value that can be used to reset the list of capabilities to add/drop when updating a service. Given the following service; | CapDrop | CapAdd | | -------------- | ------------- | | CAP_SOME_CAP | | When updating the service, and applying `--cap-drop RESET`, the "drop" list is reset to its default: | CapDrop | CapAdd | | -------------- | ------------- | | | | When updating the service, and applying `--cap-drop RESET`, combined with `--cap-add CAP_SOME_CAP` and `--cap-drop CAP_SOME_OTHER_CAP`: | CapDrop | CapAdd | | -------------- | ------------- | | CAP_FOO_CAP | CAP_SOME_CAP | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
0646789
to
23660be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
follow-up to #2687
This implements a special "RESET" value that can be used to reset the
list of capabilities to add/drop when updating a service.
Given the following service;
When updating the service, and applying
--cap-drop RESET
, the "drop" listis reset to its default:
When updating the service, and applying
--cap-drop RESET
, combined with--cap-add CAP_SOME_CAP
and--cap-drop CAP_SOME_OTHER_CAP
: