-
Notifications
You must be signed in to change notification settings - Fork 11
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: Refactor bootloader_settings to run cmds from functions, use mock in unittests #97
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #97 +/- ##
==========================================
+ Coverage 78.43% 85.34% +6.91%
==========================================
Files 2 2
Lines 255 232 -23
==========================================
- Hits 200 198 -2
+ Misses 55 34 -21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
d43ba51
to
b76088f
Compare
[citest] |
Modify unittests to mock objects
b76088f
to
604425a
Compare
@@ -363,57 +365,39 @@ def run_module(): | |||
for bootloader_setting in module.params["bootloader_settings"]: | |||
_unused, kernels_info, stderr = module.run_command("grubby --info=ALL") | |||
if "Permission denied" in stderr: | |||
module.fail_json(msg="You must run this as sudo", **result) | |||
module.fail_json("You must run this as sudo") |
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.
I realize this is unrelated to the PR, but:
Is this message for the end user of the role? If so, what action are they supposed to take?
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.
Run this as root or with ansible_become. I guess all our roles must be run with as root, but I don't see other modules to check for this. Anyway, I decided to add such a check.
[citest] |
Enhancement: Improve code readability of the bootloader_settings module