Update return code behavior #218
base: master
Are you sure you want to change the base?
Conversation
After talking to @AloisMahdal, the return codes from preupg --riskcheck should be the same as the preupg return codes (normal run). These are described here: #190. I'll update the "riskcheck code" accordingly. |
@AloisMahdal hasn't seen the comment (#218 (comment)) that says there will be another changes to this PR.
c89fdb8
to
5f6b081
Compare
Per @pirat89 the return codes should be:
I still need to figure out how or when the not_selected and not_checked results are set. |
0d7ba15
to
b074eca
Compare
I'm sorry to beat this horse again, but here's few things I think could be done better:
OK.
OK. I do agree and sympathize with this change, but I would not call it "update return code behavior". This seems a different PR to me. Then there's this "typo" thing (first commit). The problem with that is, that you can't just fix a typo and move on, it has to be clear what are the (intended) functional implications of that in order for us to be able to review code properly. As you know, the legacy code base is far from being very readable. Most of code is hard to wrap one's head around. To combat with that, what helps is to have as each change as small as possible and again, with very clear and obvious aim. But...
Now there are 7 changes that each add "mist" over the above changes, making the actual functional changes harder to see in the diff. At the same time, they are obviously needed, they don't need almost no explaining and each of them is trivial to review. Seeing them 7-commit "cleanup" PR (or even 7 PRs) would make them just go away with basically zero friction. OTOH, having to review all this one/two diffs is a headache. So, if @pirat89 (who knows the codebase much better than me) is able to do the review, I'm not goiong to block it; I'll just run some tests downstream. However, if you want to get more eyeballs on this, please consider re-splitting them as separate commits (or even PRs -- the price of having more PRs if they are easy is definitely worth it.) |
More than half of the changed code is just updating tests, so I think this fact adds up to the impression that there're so many changes for one PR. |
IMO it's interconnected - what directly affects the return code is the fact that an in-place risk is allowed only for the result fail . Before, the in-place risk did not have any effect on the return code, just the result had (fail, pass, ...). |
b074eca
to
e164903
Compare
e164903
to
871eb0a
Compare
This is the latest version of the return codes behaviour:
See https://github.com/upgrades-migrations/preupgrade-assistant/wiki/How-modules-affect-the-Preupgrade-Assistant-return-code for more details. |
6287bdd
to
0cf9483
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.
Incomplete change. The preupg/application.py still contains few "ReturnValues" instead of "PreupgReturnCodes".
preupg/xccdf.py
Outdated
if found_result not in settings.RESULT_BASED_RETURN_CODES.keys(): | ||
sys.stderr.write("Unknown result: %s\n" % found_result) | ||
sys.exit(settings.PreupgReturnCodes.INTERNAL_EXCEPTION) | ||
continue |
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.
The continue
doesn't make sense here as the sys.exit
is called before. It is dead code.
It's suspicious, that tests on jenkins succeeded.
|
4c3bc1b
to
5f729a4
Compare
547887a
to
6040296
Compare
@pirat89, as requested, the PR:
|
I found important issues in modules during testing of the new functionality that require changes. Currently there are 18 modules that has to be modified, some of them will need significant rewrite. Because of prohibited combination log_slight_risk and exit_(fixed,informational) exit codes, some FIXED and INFORMATIONAL results will be replaced by the needs_inspection result probably. Modules are not prepared currently for this change and suggest to keep it un-merged (but up-to-date) until the modules will be fixed and changes will be covered by tests. See the fix_risks branch where the modules are fixed partially (some fixes are discussable and probably will be modifed yet). NOTE: I checked only subset of all modules, it's possible that number of modules that need to be fixed is bigger. |
@pirat89, sure, I agree, let's first fix the modules according to the changes of this PR. |
We'll wait with merging this PR until the API for modules is changed per issue #318. |
6040296
to
5e25dd1
Compare
5e25dd1
to
1830e04
Compare
1830e04
to
248c68e
Compare
- rename per rhbz#1414359: - settings.ReturnValues->PreupgReturnCodes - settings.ModuleValues->ResultBasedReturnCodes
- refactor check_inplace_risk function - terminate with INTERNAL_EXCEPTION when unknown module result is detected - a module can now report an inplace risk only when the result of the module is "fail" - the purpose of the function is and has been to return a number (0-2) that corresponds to a severity of the issues found by Preupgrade Assistant modules - the returned number is determined by the modules' result (exit_x) and inplace risk (log_x_risk), whichever has higher severity - refactor replace_inplace_risk - its purpose is to replace particular modules' results in the report XML generated by OpenSCAP - it now replaces the result of a module: - from UNKNOWN to ERROR - from FAIL to ERROR if the module has no risk - from FAIL to NEEDS_INSPECTION if the module has SLIGHT or MEDIUM risk - from FAIL to NEEDS_ACTION if the module has HIGH risk - to ERROR if the module has some risk but the result isn't FAIL - remove update_inplace_risk function - dead code - fix incorrect OpenSCAP module results (not_applicable -> notapplicable, etc.) in settings.py
248c68e
to
cc5e9af
Compare
|
cc5e9af
to
3a4434e
Compare
- remove preupg_diff part of the test XMLs so the inplace_risks tests work as expected - update preupg_diff tests to still provide value
3a4434e
to
bdbff7c
Compare
Cleaning up |
Update Preupgrade Assistant to return code per table in: #218 (comment)
Cleanup
Remove:
Rename:
Per rhbz#1414359: