-
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-1275, RHELC-1516] Exit with 1 when rollback fails #1153
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1153 +/- ##
==========================================
- Coverage 95.47% 95.42% -0.05%
==========================================
Files 54 54
Lines 4682 4701 +19
Branches 824 830 +6
==========================================
+ Hits 4470 4486 +16
- Misses 131 132 +1
- Partials 81 83 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
5390b88
to
5fde95b
Compare
5fde95b
to
87833f8
Compare
87833f8
to
322e38b
Compare
40d3e35
to
a5c2880
Compare
a5c2880
to
d34251c
Compare
What was done:
|
d34251c
to
a6c7f00
Compare
a6c7f00
to
6422efc
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.
Seems good, minor things. Will you add integration tests?
6422efc
to
6b150ff
Compare
What was done:
|
6b150ff
to
e8c261e
Compare
(I'll take look to the unit tests later) |
Solved and rebased :) EDIT: I see new conflict :( |
b2e74c6
to
131fbf4
Compare
131fbf4
to
f0a820e
Compare
|
.. warning:: | ||
Exceptions are not handled and left for handling by the calling code. |
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.
.. warning:: | |
Exceptions are not handled and left for handling by the calling code. | |
.. warning:: | |
Exceptions are not handled and left for handling by the calling code. |
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.
Deindent the waring section
convert2rhel/backup/files.py
Outdated
.. warning:: | ||
Exceptions are not handled and left for handling by the calling code. |
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.
.. warning:: | |
Exceptions are not handled and left for handling by the calling code. | |
.. warning:: | |
Exceptions are not handled and left for handling by the calling code. |
raise exceptions.CriticalError( | ||
id_="FAILED_TO_SUBSCRIBE_SYSTEM", | ||
title="Failed to subscribe system.", | ||
description="Failed to restore the /etc/os-release file needed for subscribing the system.", | ||
diagnosis="The restore failed with error %s." % (str(e)), | ||
) |
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.
Maybe we should use a different id and tittle? We are not subscribing the system at this point, only trying to restore the os_release file.
The registration comes in the line 261
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.
I mean, the procedure is for registering the system, but at this specific step we are not actually registering
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.
I was thinking about that, and it resulted in this. I see it that we are trying to subscribe the system and this is part of the process. The problem is then specified in the description and diagnostic.
But if we would find a better name, I will change that, no problem. I'm not sure which, I felt like FAILED_TO_RESTORE_OSRELEASE
is a bit misleading.... But I'm not sure there, the naming is the hardest part sometimes 😄
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.
This is a big question and I feel like we need a wiki page or something with all of these things, when to use what, and how each is triggered etc. At the moment it's just "this feels good" but it can lead to confusing things for the customer
Since this prevents the system from being registering it still fails to register, so I feel like this error is still accurate
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.
Looks good! Only one question though.
Rebase and fix the indentation on warnings, run tier0 (can do so by applying the labels after builds are done, and if tests are good we can merge |
f0a820e
to
e5a1bb0
Compare
e5a1bb0
to
e78c99a
Compare
e78c99a
to
8f84e14
Compare
/packit test --labels tier0 |
* Fixed unit tests * Adjusted the return code with the new ConversionExitCodes
e46e929
to
b19d720
Compare
Fixed the indentation and rebased |
@danmyway Do we need new integration tests for this or do we have it covered? |
Not that critical from my POV, we can add it in a separate batch @hosekadam |
/packit test --labels tier0 |
LGTM. @hosekadam please update the Jira issues to Dev Complete when you can! |
There is a need to exit with exit code 1 when rollback fails to provide the ability to better recognize those types of failures for Insights. This situation can mainly happen when user uses analyze command or during the conversion answers "No" and user doesn't want to continue over point of no return. In those situations, rollback is processed and when it fails, the system is in an unknown state.
Expected behavior:
When rollback fails, c2r exits with 1, warning about unknown state and system should be restored from backup is printed. Any summaries of the report aren't printed or saved - because there is any big value of the report when the rollback failed.
How it was solved:
The new property
backup_failed
of BackupController was added. This property is based on instance variable_rollback_failed
which is set when restore method of some restorable fails.I chose this solution because it keeps the code simple. Other solution with returning some value required a lot of code changed and added complexity to the codebase.
I also added a new function in
main.py
for printing info after rollback, which we do in two places. The goal was to reduce duplicity in this part of code.To have captured exceptions during the rollback, I've also removed handling of exceptions in each restorable and let it up to
BackupController
. By this change I found a bug in the code, when the restorable file was removed from the backup folder when doing the restore for conversion purposes. The file should stay in the backup folder, if we would remove it, then we won't have anything when processing the rollback.Jira Issues: RHELC-1275, RHELC-1516
Checklist
[RHELC-]
is part of the PR titleRelease Pending
if relevant