-
Notifications
You must be signed in to change notification settings - Fork 72
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 #26050 - yum exclude list #244
Conversation
Issues: #25939 |
@upadhyeammit is the right issue linked to the PR. Shouldn't it be https://projects.theforeman.org/issues/26050? |
c5ab524
to
fea27dc
Compare
@mbacovsky my mistake :( changed it ! Thank You ! |
@upadhyeammit I have tested this pr and found below issue.
|
fea27dc
to
4bfca24
Compare
@jameerpathan111 I switched to yum.conf which is fixing your concern. Request to check. |
@jameerpathan111 I can see one more issue with this pr, if yum.conf not having exclude defined it will fail ! The yum-config-manager use to help with this situation, I am checking this one further. |
4bfca24
to
f9c6ad6
Compare
What is the status here? |
From my side work is complete, when we had last meeting @mbacovsky mentioned that this may need changes because of version lock PR . |
@mbacovsky mind having a look? |
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.
@upadhyeammit I did some more testing and it behaves almost as expected. However I took me quite some time to understand why. I've suggested some changes inside.
As for our discussion on using the package manager layer - I don't think we need to do that now. The functionality is nicely bundled in one file and I have no idea how excluding of packages works in Debian world so I guess it would slip this for too long. What do you think?
definitions/checks/yum_exclude.rb
Outdated
end | ||
|
||
def run | ||
assert(exclude_set?, 'The /etc/yum.conf has exclude list configured as below,'\ |
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 assumed from the exclude_set?
name that it would return true if exclude is set in yum but it does the opposite. That confused me a lot. How about exclude_unset?
or !exclude_used?
or similar? Or did I miss something?
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 changed it to return true when exclude is set, sorry for confusion !
definitions/checks/yum_exclude.rb
Outdated
end | ||
|
||
def exclude_set? | ||
yum_exclude == 'exclude=' || yum_exclude == 'exclude =' |
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 call the grep twice in many cases and misses e.g. '# exclude=kernel*'. Could we use regexp instead like
yum_exclude =~ /^exclude\s*=\s*\S+/
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 changed this to regular expression, miss from my side about commented exclude line.
definitions/checks/yum_exclude.rb
Outdated
def yum_exclude | ||
execute!('grep -w exclude /etc/yum.conf') | ||
rescue ForemanMaintain::Error::ExecutionError | ||
'exclude=' |
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 feels quite hacky, could we return empty string here?
Perhaps we could call the method grep_yum_exclude
to see better what it does.
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 changed the method name and now using execute_with_status which returns empty string when exclude is not set.
I am also not familiar with how Debian handles excluding packages, I would explore on it but now what I feel is we should merge this for yum after taking care of suggestions added by you. I will check for Debian side and would be including it next. |
f9c6ad6
to
bfc0cf1
Compare
There were the following issues with the commit message:
If you don't have a ticket number, please create an issue in Redmine. More guidelines are available in Coding Standards or on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
bfc0cf1
to
096cdb8
Compare
@mbacovsky with recent commit only thing is we call grep twice when exclude is set, I was trying to avoid it but it was unnecessarily adding more lines to check and I feel one extra grep command call should not be that expensive. Request to review once ! thank you ! |
@upadhyeammit thank you for the update and incorporating my comments. I checked on the PR and it looks good. However I'm still not very convinced about the unnecessary double grep call in the check (the execution is logged twice, new subshell is executed etc) so I'm sorry but I'd appreciate if we can get rid of it. Could you please reconsider it? |
No problem at all, will send fix for same ! thank you for review |
@mbacovsky did changes as requested, thank you for help ! Request to have a look |
7be6aa3
to
797e771
Compare
@upadhyeammit thank you for the update, I really appreciate it. I'll merge this once the tests finish and are green. |
ack! Travis was failing due to freeze for regex, I removed it and it should be green now! |
Thanks again @upadhyeammit! |
This adds check for yum exclude list, if its configured then user gets error with message. The message includes which file has configured it and what is value of same.