-
Notifications
You must be signed in to change notification settings - Fork 285
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
Update update.precheck/apply to be compatible with yum and dnf #5564
Update update.precheck/apply to be compatible with yum and dnf #5564
Conversation
Given XS9 has deplicated yum with dnf, to be compatible with XS8, - Use dnf if dnf is detected - Fallback to yum otherwise Signed-off-by: Lin Liu <lin.liu@citrix.com>
Signed-off-by: Lin Liu <lin.liu@citrix.com>
This PR contains two commits
|
@@ -48,6 +48,14 @@ ERRORCODE = 'errorcode' | |||
ERROR = 'error' | |||
FOUND = 'found' | |||
REQUIRED = 'required' | |||
YUM_CMD = '/usr/bin/yum' | |||
DNF_CMD = '/usr/bin/dnf' | |||
PKG_MGR = DNF_CMD if os.path.exists(DNF_CMD) else YUM_CMD |
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 not using OO as it could: have a class that does what we need and zwo small sub-classes: one for yum and one for dnf. This would avoid the branching we are seeing here. It's probably ok because I don't expect more variation here.
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.
Yes, it can be.
As you already point out, this is only tiny diff here between yum and dnf.
Even with class, we need branching which class to use anyway, so I prefer to just this none-OO styple, does this make sense? (If more and more variation comes, then we can use OO later.)
Co-authored-by: Luca Zhang <feiya.zhang@cloud.com> Signed-off-by: liulinC <lin.liu@citrix.com>
Co-authored-by: Luca Zhang <feiya.zhang@cloud.com> Signed-off-by: liulinC <lin.liu@citrix.com>
@duobei Thanks for the help. I was intentionally to keep the original code to
|
Signed-off-by: Lin Liu <lin.liu@citrix.com>
I'm sorry for the trouble. I'll take care of these next. |
All the suggestions are really good point, thanks again for the help. 👍 |
pytype_reporter extracted 50 problem reports from pytype output. You can check the results of the job here |
Testing done:
dnf install
,xe update-apply