change the logic of sorting
This commit is contained in:
parent
40dedfb707
commit
30badbe1dd
2 changed files with 6 additions and 7 deletions
|
@ -13,7 +13,7 @@ class RhelRpmToCve
|
||||||
def list_pkg_names
|
def list_pkg_names
|
||||||
xml[:rpms][:rpm].map do |key|
|
xml[:rpms][:rpm].map do |key|
|
||||||
key.first[:rpm]
|
key.first[:rpm]
|
||||||
end.sort
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pkg_exists?(pkg_name)
|
def pkg_exists?(pkg_name)
|
||||||
|
@ -30,7 +30,8 @@ class RhelRpmToCve
|
||||||
:rhel_package_name => pkg_name,
|
:rhel_package_name => pkg_name,
|
||||||
:cves => results.map {|cve| cve}
|
:cves => results.map {|cve| cve}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
'Package not found.'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,8 @@ parser.parse!
|
||||||
pkg_name = options[:pkg]
|
pkg_name = options[:pkg]
|
||||||
rpm_auditer = RhelRpmToCve.new(data_file)
|
rpm_auditer = RhelRpmToCve.new(data_file)
|
||||||
|
|
||||||
if rpm_auditer.pkg_exists?(pkg_name)
|
if pkg_name
|
||||||
pp rpm_auditer.cves_per_pkg_name(pkg_name)
|
pp rpm_auditer.cves_per_pkg_name(pkg_name)
|
||||||
elsif options.key?(:list)
|
else options.key?(:list)
|
||||||
puts rpm_auditer.list_pkg_names
|
puts rpm_auditer.list_pkg_names.sort
|
||||||
else
|
|
||||||
puts 'Package not found.'
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue