Skip to content

Commit

Permalink
fix: check mode should not give an error
Browse files Browse the repository at this point in the history
Cause: The blivet module was not looking for the check_mode flag before
reporting an error when the supporting modules could not be loaded.

Consequence: The storage role would give an error in check mode in the
"Get required packages" task.

Fix: See if the role is running in check mode, and do not report an
error if the underlying modules cannot be loaded.  This is expected.

Result: The storage role does not print an error when running in
check mode.

Signed-off-by: Rich Megginson <[email protected]>
  • Loading branch information
richm committed Jul 22, 2024
1 parent 06844b5 commit 978ab07
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2396,7 +2396,7 @@ def run_module():

module.params.update(updated_params)

if not BLIVET_PACKAGE:
if not BLIVET_PACKAGE and not module.check_mode:

Check warning on line 2399 in library/blivet.py

View check run for this annotation

Codecov / codecov/patch

library/blivet.py#L2399

Added line #L2399 was not covered by tests
module.fail_json(msg="Failed to import the blivet or blivet3 Python modules",
exception=inspect.cleandoc("""
blivet3 exception:
Expand Down

0 comments on commit 978ab07

Please sign in to comment.