Skip to content

Commit

Permalink
Avoid printing any log messages unless log level is DEBUG
Browse files Browse the repository at this point in the history
Importing the shim should be silent. If the system RPM module fails
to import, ImportError will be raised, and that makes it clear that
the process failed.

Signed-off-by: Nikola Forró <[email protected]>
  • Loading branch information
nforro committed Feb 10, 2023
1 parent f0978c7 commit 36e8a42
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rpm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ def initialize() -> None:
except ShimAlreadyInitializingError:
continue
except Exception as e:
logger.error(f"Exception: {e}")
logger.debug(f"Exception: {type(e)}: {e}")
continue
else:
raise ImportError("Failed to import system RPM module")
raise ImportError(
"Failed to import system RPM module. "
"Make sure RPM Python bindings are installed on your system."
)


# avoid repeated initialization of the shim module
Expand Down

0 comments on commit 36e8a42

Please sign in to comment.