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

[RHELC-1393] Move logger initialization to initialize module #1095

Merged
merged 2 commits into from
Feb 20, 2024

Conversation

r0x0d
Copy link
Member

@r0x0d r0x0d commented Feb 12, 2024

Initializing the logger module earlier makes the tool work correctly when trying to find the /etc/system-release file, and if it is not there, throw a critical error to the user before anything else happens.

If we don't move the module to this point, the first /etc/system-releaes check will silently fail and only the next call will throw the exception, because at this point, we already have the logger initialized.

To prevent further executions in the system, it is more reliable to initialize the logger module earlier.

Jira Issues: RHELC-1393

Checklist

  • PR has been tested manually in a VM (either author or reviewer)
  • Jira issue has been made public if possible
  • [RHELC-] is part of the PR title
  • GitHub label has been added to help with Release notes
  • PR title explains the change from the user's point of view
  • Code and tests are documented properly
  • The commits are squashed to as few commits as possible (without losing data)
  • When merged: Jira issue has been updated to Release Pending if relevant

@r0x0d r0x0d added kind/bug-fix A bug has been fixed tests/tier0 PR ready to run the essential test suit. Equivalent to `/packit test --labels tier0`. labels Feb 12, 2024
@r0x0d r0x0d requested a review from Venefilyn February 12, 2024 18:34
@has-bot
Copy link
Member

has-bot commented Feb 12, 2024

/packit test --labels tier0


Comment generated by an automation.

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9b08cc6) 94.89% compared to head (e8d4af8) 94.90%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1095   +/-   ##
=======================================
  Coverage   94.89%   94.90%           
=======================================
  Files          49       49           
  Lines        4549     4550    +1     
  Branches      809      809           
=======================================
+ Hits         4317     4318    +1     
  Misses        156      156           
  Partials       76       76           
Flag Coverage Δ
centos-linux-7 90.08% <100.00%> (+<0.01%) ⬆️
centos-linux-8 91.08% <100.00%> (+<0.01%) ⬆️
centos-linux-9 91.13% <100.00%> (+<0.01%) ⬆️

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.

Initializing the logger module earlier makes the tool work correctly
when trying to find the /etc/system-release file, and if it is not
there, throw a critical error to the user before anything else happens.

If we don't move the module to this point, the first /etc/system-releaes
check will silently fail and only the next call will throw the
exception, because at this point, we already have the logger
initialized.

To prevent further executions in the system, it is more reliable to
initialize the logger module earlier.

Signed-off-by: Rodolfo Olivieri <[email protected]>
@r0x0d r0x0d force-pushed the traceback-in-missing-file branch from c4b1530 to e8d4af8 Compare February 20, 2024 14:21
@r0x0d r0x0d requested a review from Venefilyn February 20, 2024 14:22
@r0x0d
Copy link
Member Author

r0x0d commented Feb 20, 2024

/packit test --labels tier0

Copy link
Contributor

@pr-watson pr-watson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me!

@pr-watson
Copy link
Contributor

Only 1 test failing unrelated to code, merging

@pr-watson pr-watson merged commit 790db4b into oamg:main Feb 20, 2024
46 of 57 checks passed
@r0x0d r0x0d deleted the traceback-in-missing-file branch February 21, 2024 02:05
@Venefilyn Venefilyn mentioned this pull request Feb 22, 2024
jochapma pushed a commit to jochapma/convert2rhel that referenced this pull request Mar 11, 2024
* Move logger initialization to initialize module

Initializing the logger module earlier makes the tool work correctly
when trying to find the /etc/system-release file, and if it is not
there, throw a critical error to the user before anything else happens.

If we don't move the module to this point, the first /etc/system-releaes
check will silently fail and only the next call will throw the
exception, because at this point, we already have the logger
initialized.

To prevent further executions in the system, it is more reliable to
initialize the logger module earlier.

Signed-off-by: Rodolfo Olivieri <[email protected]>

* Revert initialize_file_logger function

Signed-off-by: Rodolfo Olivieri <[email protected]>

---------

Signed-off-by: Rodolfo Olivieri <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-fix A bug has been fixed tests/tier0 PR ready to run the essential test suit. Equivalent to `/packit test --labels tier0`.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants