Skip to content
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

Merged
merged 6 commits into from
May 22, 2019
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions definitions/checks/yum_exclude.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Checks::YumExclude < ForemanMaintain::Check
metadata do
label :check_yum_exclude_list
description 'Check if yum exclude list is configured'
tags :pre_upgrade
end

EXCLUDE_SET_RE = /^exclude\s*=\s*\S+.*$/.freeze

def run
grep_result = grep_yum_exclude
assert(!grep_result.match(EXCLUDE_SET_RE),
'The /etc/yum.conf has exclude list configured as below,'\
"\n #{grep_result}"\
"\nUnset this as it can cause yum update or upgrade failures !")
end

def grep_yum_exclude
execute_with_status('grep -w exclude /etc/yum.conf')[1]
end
end