Skip to content

Commit

Permalink
Refs #25186 - hotfix rpms by rpm command
Browse files Browse the repository at this point in the history
  • Loading branch information
kgaikwad committed Dec 26, 2018
1 parent 9d55a7a commit 54bb688
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions definitions/checks/check_hotfix_installed.rb
Expand Up @@ -16,7 +16,8 @@ def run
skip 'Your system is subscribed using custom activationkey'
else
with_spinner('Checking for presence of hotfix(es). It may take some time to verify.') do
hotfix_rpmlist, installed_pkg_list = installed_packages
hotfix_rpmlist = find_hotfix_packages
installed_pkg_list = installed_packages
files_modifications = installed_pkg_list.flat_map { |pkg| modified_files(pkg) }
assert(hotfix_rpmlist.empty? && files_modifications.empty?,
warning_message(hotfix_rpmlist, files_modifications))
Expand All @@ -40,17 +41,22 @@ def modified_files(package)
end

def installed_packages
hotfix_packages = []
packages = []
repoquery_cmd = execute!('which repoquery')
IO.popen([repoquery_cmd, '-a', '--installed', '--qf', '%{ui_from_repo} %{nvra}']) do |io|
io.each do |line|
repo, pkg = line.chomp.split
hotfix_packages << pkg if pkg.include?('HOTFIX')
packages << pkg if /satellite|rhscl/ =~ repo[1..-1]
end
end
[hotfix_packages, packages]
packages
end

def find_hotfix_packages
output = execute!('rpm -qa release="*HOTFIX*"').strip
return [] if output.empty?

output.split("\n")
end

def warning_message(hotfix_rpmlist, files_modified)
Expand Down

0 comments on commit 54bb688

Please sign in to comment.