Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[CoE] Security Roles - drift report & config #348
base: main
Are you sure you want to change the base?
[CoE] Security Roles - drift report & config #348
Changes from all commits
e335844
bc4320c
f4e5963
d18d437
fc43643
bcf38bc
a8b984d
80f60fd
c5bc023
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
suggestion This should either
get
or actually search. For instance, on my current test instance,vcenter_roles.find
returns one called "Resource pool administrator (sample)".However,
vcenter_roles.find administrator
doesn't return any results. I have to seek forvcenter_roles.find "Resource pool administrator (sample)"
in order to get the role, which isget
rather thanfind
, since I need to know the name first.If it's important to be able to allow exact matches, I'd do something like add
exact=False
to the arguments, and then add a bit of logic to catch all that.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.
If changing this to actually search, it would be:
This would treat an empty string as
role_name
as the same as None, which is probably expected behavior.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.
Also for a case insensitive match:
role_name.lower() not in role.info.label.lower()
(or.upper()
)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.
suggestion Also should note that permissions that do not exist will be ignored, Like I just tried saving a role with resource privileges of
["Create resource pool", "Query vMotion", "lulz", "not real"]
, and this worked just fine and ignored the non-existent lulz/not real bits.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.
suggestion try this with a non-existent group, e.g.
salt-call vcenter_roles.save '{"role": "Blerps", "privileges": {"Fnord": ["Create resource pool", "something else", "cool guy"]}}'
You should see this raise a
KeyError
, which is not so good 😅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.
suggestion privileges are already lists (i.e.
[]
). FWIW, this is also always going to dojson.dumps
which theoretically could be a performance hit, especially for large deployments.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.
If order isn't important, changing them to
set()
and using the correct methods would be 👍