-
Notifications
You must be signed in to change notification settings - Fork 84
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-1347] Update report to include post conversion actions #1151
Conversation
5f09650
to
1292d73
Compare
1292d73
to
47a0dc7
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1151 +/- ##
==========================================
+ Coverage 95.36% 95.38% +0.01%
==========================================
Files 53 53
Lines 4619 4635 +16
Branches 809 810 +1
==========================================
+ Hits 4405 4421 +16
Misses 137 137
Partials 77 77
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
47a0dc7
to
f46d9c7
Compare
f46d9c7
to
fc933d7
Compare
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.
Didn't review unit tests yet
6fbf2af
to
e21d561
Compare
e21d561
to
97a67f7
Compare
/packit test --labels tier0 |
97a67f7
to
78fc118
Compare
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.
Implementation seems pretty good to me, just wondering about the usage of deciding pre-conversion vs post-conversion report in the try-finally. I feel like it introduces technical debt for future refactoring
@SpyTec, I agree, and by far, this doesn't even look like a solid implementation. What do you think about something like this? (It's just a draft, so I just put whatever name I first thought of) diff --git a/convert2rhel/main.py b/convert2rhel/main.py
index f59b738..f26e563 100644
--- a/convert2rhel/main.py
+++ b/convert2rhel/main.py
@@ -43,6 +43,18 @@ class ConversionPhase:
POST_PONR_CHANGES = 4
+_REPORT_MAPPING = {
+ ConversionPhase.PRE_PONR_CHANGES: (
+ report.CONVERT2RHEL_PRE_CONVERSION_JSON_RESULTS,
+ report.CONVERT2RHEL_PRE_CONVERSION_TXT_RESULTS,
+ ),
+ ConversionPhase.POST_PONR_CHANGES: (
+ report.CONVERT2RHEL_POST_CONVERSION_JSON_RESULTS,
+ report.CONVERT2RHEL_POST_CONVERSION_TXT_RESULTS,
+ ),
+}
+
+
def initialize_file_logging(log_name, log_dir):
"""
Archive existing file logs and setup all logging handlers that require
@@ -182,16 +194,12 @@ def main_locked():
# Write the assessment to a file as json data so that other tools can
# parse and act upon it.
results = _pick_conversion_results(process_phase, pre_conversion_results, post_conversion_results)
- json_filepath = report.CONVERT2RHEL_PRE_CONVERSION_JSON_RESULTS
- txt_filepath = report.CONVERT2RHEL_PRE_CONVERSION_TXT_RESULTS
- if process_phase == ConversionPhase.POST_PONR_CHANGES:
- json_filepath = report.CONVERT2RHEL_POST_CONVERSION_JSON_RESULTS
- txt_filepath = report.CONVERT2RHEL_POST_CONVERSION_TXT_RESULTS
+ if results and process_phase in _REPORT_MAPPING:
+ json_report, txt_report = _REPORT_MAPPING[process_phase]
- if results:
- report.summary_as_json(results, json_filepath)
- report.summary_as_txt(results, txt_filepath)
+ report.summary_as_json(results, json_report)
+ report.summary_as_txt(results, txt_report)
return 0 It looks less bad or more bad? |
I think it definitely looks better. If you can change it to that for now that would be good, then we can merge. For |
78fc118
to
e18a0f6
Compare
In this commit, we are introducing two new stages for enabling the post conversion in the action framework. We are also introducing an environment variable to not break the current workflow and let the conversion function as-is for now. Anyone that is willing to test and run the post conversion actions will need to use this environment var.
The report had to be updated to include the post conversion results from the actions, since we are extending the framework and migrating the functions to become actions, we need to make a few modifications to adapt the reporting to work with both pre and post-conversion actions.
Introducing a mapping that handles the correlation between conversion phase and path of json/txt files.
e18a0f6
to
7633a3a
Compare
/packit test --labels tier0 |
The report had to be updated to include the post conversion results from
the actions, since we are extending the framework and migrating the
functions to become actions, we need to make a few modifications to
adapt the reporting to work with both pre and post conversion actions.
Jira Issues: RHELC-1347
Checklist
[RHELC-]
is part of the PR titleRelease Pending
if relevantDepends on