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
argocd-util should allow editing project policies in bulk #2615
Conversation
9fb524e
to
8dd6f21
Compare
Codecov Report
@@ Coverage Diff @@
## master #2615 +/- ##
==========================================
- Coverage 37.93% 37.92% -0.02%
==========================================
Files 116 117 +1
Lines 16130 16259 +129
==========================================
+ Hits 6119 6166 +47
- Misses 9200 9274 +74
- Partials 811 819 +8
Continue to review full report at Codecov.
|
…ows to update multiple project policies
64d6f0d
to
e88c9a0
Compare
@alexec can you take a look again please. your comments were addressed |
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.
Some minor comments - but I think we should sit down and discus this, as I don't fully understand
return command | ||
} | ||
|
||
func globMatch(pattern string, val string) bool { |
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.
rename val
to something else? path
?
} | ||
|
||
func globMatch(pattern string, val string) bool { | ||
if pattern == "*" { |
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.
doesn't this get picked up by the filepath.Match
?
|
||
func getModification(modification string, resource string, scope string, permission string) (func(string, string) string, error) { | ||
switch modification { | ||
case "set": |
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.
add unit test please
} | ||
actionPolicyIndex := -1 | ||
for i := range role.Policies { | ||
parts := split(role.Policies[i], ",") |
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.
untested?
updated = true | ||
role.Policies = append(role.Policies[:actionPolicyIndex], role.Policies[actionPolicyIndex+1:]...) | ||
} else if actionPolicyIndex > -1 && policyPermission != "" { | ||
updated = true |
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.
untested?
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.
Ops. I believe I request changes for this.
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.
Conditional approval: please create an issue to complete the tests for this.
* Implement 'argocd-util projects update-role-policy' command which allows to update multiple project policies
Closes #2614
Checklist:
CLI example: