-
Notifications
You must be signed in to change notification settings - Fork 71
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
Fixes #30120 - Added check-update option in foreman-maintain #355
Fixes #30120 - Added check-update option in foreman-maintain #355
Conversation
patilsuraj767
commented
Jun 15, 2020
Issues: #30120 |
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.
Thank you @patilsuraj767
Looks good to me! Added small inline comment.
yum_options = [] | ||
packages = [packages].flatten(1) | ||
yum_options << '-y' if assumeyes | ||
yum_options << '--disableplugin=foreman-protector' |
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.
Will this option be only for check_update
?
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.
No, this option will for all the yum related task.
With "--disableplugin=foreman-protector" in place there is no need to unlock package while performing yum related task.
We will need to revisit all the commands/scenarios where we are doing yum related task and will need to remove the step Procedures::Packages::UnlockVersions
For example - While installing package - code.
I think we should do above refactoring in separate PR.
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 think we should do above refactoring in separate PR.
Could you please create one refactoring issue for tracking this change?
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 have opened the issue for refactoring - #30393
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.
It works as expected. I am not liking the idea of hardcoding --disableplugin=foreman-protector
in yum_options. I still prefer the method to unlock packages and lock it again; as this feels like hack.
Maybe if we want to save the extra logic of disable and enable plugin which has written in setup_protector ? you can override yum_options in setup_protector itself ?
With this we should change the description of check-update
command to,
check-update Check for available package updates in unlocked session
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 am not sure how we can override the yum_options in setup_protector, because currently yum_option variable is scoped for def yum_action
.
Let me tell you why I think '--disableplugin=foreman-protector' is better option.
a) I did not found any scenario where we do yum action without unlocking packages(disabling foreman-protector) plugin.
b) In the current code, I think there are two scenarios where foreman-maintain can leave packages in the unlocked state.
- If you see the implementation here -
add_step_with_context(Procedures::Packages::UnlockVersions) - We are not explicitly locking the packages in any scenario, rather we are relying on foreman-installer, thinking that it will do the job of locking the packages but what if the installer fails in between? then the package will still stay in the unlocked state.
Using the --disableplugin=foreman-protector
will make sure that the package will not be in unlock state ever.
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.
Also, with this fix, we can get rid of this kind of issues - #30414.
No additional comments from my side. |
As per offline discussion, I have tested by passing invalid plugin name.
|
@jameerpathan111 or @vsedmik can you help to test this change ? Most important is, with this change packages wont be unlocked while doing packages actions from foreman-maintain. |
yeah, sure. will take a look at it this week. |
8900452
to
3060967
Compare
3060967
to
a94d478
Compare
Tested on latest versions and works without any problem. Merging! |