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

refactor: Resolve action from cmd flags and args #62

Merged
merged 1 commit into from
Feb 17, 2020
Merged

refactor: Resolve action from cmd flags and args #62

merged 1 commit into from
Feb 17, 2020

Conversation

danielpacak
Copy link
Contributor

@danielpacak danielpacak commented Feb 16, 2020

This is an intermediate step to finally have the API as follows:

action, err := ResolveAction(clientConfig, flags, args)

whoCan, err := NewWhoCan(clientConfig)
roleBindings, clusterRoleBindings, err := whoCan.Check(action)
PrintChecks(os.Stdout, action, roleBindings, clusterRoleBindings)

@danielpacak danielpacak marked this pull request as ready for review February 17, 2020 11:05
@danielpacak danielpacak requested a review from knqyf263 February 17, 2020 11:09
@lizrice
Copy link
Contributor

lizrice commented Feb 17, 2020

Codecov Report

Merging #62 into master will decrease coverage by 2.66%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #62      +/-   ##
==========================================
- Coverage   73.02%   70.36%   -2.67%     
==========================================
  Files           5        5              
  Lines         393      388       -5     
==========================================
- Hits          287      273      -14     
- Misses         91       99       +8     
- Partials       15       16       +1     

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 30574d1...fb538ba. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Feb 17, 2020

Codecov Report

Merging #62 into master will decrease coverage by 2.48%.
The diff coverage is 69.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #62      +/-   ##
==========================================
- Coverage   73.02%   70.54%   -2.49%     
==========================================
  Files           5        5              
  Lines         393      387       -6     
==========================================
- Hits          287      273      -14     
- Misses         91       99       +8     
  Partials       15       15
Impacted Files Coverage Δ
pkg/cmd/list.go 56.38% <69.69%> (-4.56%) ⬇️

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 30574d1...cee44d3. Read the comment docs.

pkg/cmd/list.go Outdated
err = fmt.Errorf("resolving resource: %v", err)
return
}
glog.V(3).Infof("Resolved resource `%s`", w.resource)
Copy link
Contributor

Choose a reason for hiding this comment

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

Even if w.resource is empty, this message will be shown, right? The current implementation doesn't display it.
https://github.com/aquasecurity/kubectl-who-can/pull/62/files#diff-7f1690f58d7299440bd878e1c25d001bL188

Is it OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if w.resource is empty, this message will be shown, right? The current implementation doesn't display it.
https://github.com/aquasecurity/kubectl-who-can/pull/62/files#diff-7f1690f58d7299440bd878e1c25d001bL188

Is it OK?

Good catch. Thank you. It doesn't harm, but I reverted it anyway to only invoke ResourceResolver for Kubernetes resources. It doesn't make sense to call resolver for NonResourceURL args.

Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
@danielpacak danielpacak requested a review from knqyf263 February 17, 2020 13:28
@danielpacak danielpacak merged commit e46c1b2 into aquasecurity:master Feb 17, 2020
@danielpacak danielpacak deleted the refactor_resolve_action branch February 17, 2020 13:34
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.

4 participants