-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
krb_ticket: Create module #8953
Conversation
Hello @russoz! Could you please provide some help for using Helper class to unit test self.mock_run_command = patch('%s.run_command' % ansible_module_path)
self.module_main_command = self.mock_run_command.start()
self.mock_get_bin_path = patch('%s.get_bin_path' % ansible_module_path)
self.get_bin_path = self.mock_get_bin_path.start()
self.get_bin_path.return_value = '/testbin/kinit' |
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.
The YAML spec used has changed - apologies, I should have let you know - and the outcome of the old test structure running in the new code is that get_bin_path()
does not get to be mocked, therefore it fails to find the binary and the problem cascades.
Thanks for exposing this, please do apply the necessary changes, whilst I update the docs and the code to be more comprehensive and resilient.
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.
Couple of comments about your code.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
If I may suggest, give it a try to https://pypi.org/project/andebox/ You can run this sanity test easily in your local machine by simply running:
|
Thats very useful, thanks! |
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.
Thanks for your contribution! I have a few docs comments :)
Thanks for the review! @felixfontein |
plugins/modules/kutils.py
Outdated
renewable: | ||
description: | ||
- Requests renewable tickets, with a total lifetime equal to O(renewable). | ||
- "The value for O(renewable) must be followed by one of the following delimiters: V(s) - seconds, V(m) - minutes, V(h) - hours, V(d) - days." |
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 wordsmithing: delimiters usually mean something between things - not the case here. Maybe:
- "The value for O(renewable) must be followed by one of the following delimiters: V(s) - seconds, V(m) - minutes, V(h) - hours, V(d) - days." | |
- "The value for O(renewable) must be followed by one of the following suffixes: V(s) - seconds, V(m) - minutes, V(h) - hours, V(d) - days." |
?
plugins/modules/kutils.py
Outdated
required_by={ | ||
'keytab_path': 'keytab' | ||
}, |
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.
The docs for keytab_path
state that when it is provided, then keytab
must be True
. This required_by
will not guarantee you that - it will only guarantee that keytab
is not None
. Maybe the module needs to check and raise and exception if keytab_path is not None and keytab is not True
.
I changed the name from |
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
@abakanovskii thanks for your contribution! |
SUMMARY
I created a
krb_ticket
module to serve as wrapper aroundkinit
/klist
/kdestroy
ISSUE TYPE
COMPONENT NAME
krb_ticket
ADDITIONAL INFORMATION
So It is a simple yet very useful wrapper around krb5 base utilities because although It is used quite often there are not module to manage these without using
shell
/command
modulesI took @russoz suggestion about simple unit testing using Helper class with yaml, thanks you very much :)