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: Refactor bootloader_settings to run cmds from functions, use mock in unittests #97

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

spetrosi
Copy link
Contributor

Enhancement: Improve code readability of the bootloader_settings module

@spetrosi spetrosi requested a review from richm as a code owner April 18, 2024 09:57
Copy link

codecov bot commented Apr 18, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 85.34%. Comparing base (63d7c0c) to head (604425a).
Report is 14 commits behind head on main.

Files Patch % Lines
library/bootloader_settings.py 86.66% 6 Missing ⚠️
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     
Flag Coverage Δ
sanity ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@spetrosi spetrosi marked this pull request as draft April 18, 2024 10:14
@spetrosi
Copy link
Contributor Author

[citest]

@spetrosi spetrosi marked this pull request as ready for review April 18, 2024 13:06
@spetrosi spetrosi changed the title chore: Refactor bootloader_settings to run cmds from functions, use mock in unittests ref: Refactor bootloader_settings to run cmds from functions, use mock in unittests Apr 18, 2024
@spetrosi spetrosi changed the title ref: Refactor bootloader_settings to run cmds from functions, use mock in unittests refactor: Refactor bootloader_settings to run cmds from functions, use mock in unittests Apr 18, 2024
@@ -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")
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@richm
Copy link
Contributor

richm commented Apr 19, 2024

[citest]

@richm richm merged commit 6d2e224 into linux-system-roles:main Apr 22, 2024
27 of 29 checks passed
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.

2 participants