Code Review
/
puppet-modules
/
puppetlabs-apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Release prep v9.1.0
[puppet-modules/puppetlabs-apt.git]
/
lib
/
facter
/
apt_updates.rb
diff --git
a/lib/facter/apt_updates.rb
b/lib/facter/apt_updates.rb
index e3b17d957e0a85a24f4f4782acf130de55a5d196..66c6a892867be4b15161f41cc84aad3ea9ca0510 100644
(file)
--- a/
lib/facter/apt_updates.rb
+++ b/
lib/facter/apt_updates.rb
@@
-9,11
+9,12
@@
apt_dist_updates = nil
def get_updates(upgrade_option)
apt_updates = nil
if File.executable?('/usr/bin/apt-get')
def get_updates(upgrade_option)
apt_updates = nil
if File.executable?('/usr/bin/apt-get')
- apt_get_result = Facter::
Util::Resolution.exec
("/usr/bin/apt-get -s -o Debug::NoLocking=true #{upgrade_option} 2>&1")
+ apt_get_result = Facter::
Core::Execution.execute
("/usr/bin/apt-get -s -o Debug::NoLocking=true #{upgrade_option} 2>&1")
unless apt_get_result.nil?
apt_updates = [[], []]
apt_get_result.each_line do |line|
next unless %r{^Inst\s}.match?(line)
unless apt_get_result.nil?
apt_updates = [[], []]
apt_get_result.each_line do |line|
next unless %r{^Inst\s}.match?(line)
+
package = line.gsub(%r{^Inst\s([^\s]+)\s.*}, '\1').strip
apt_updates[0].push(package)
security_matches = [
package = line.gsub(%r{^Inst\s([^\s]+)\s.*}, '\1').strip
apt_updates[0].push(package)
security_matches = [
@@
-22,9
+23,7
@@
def get_updates(upgrade_option)
%r{ gNewSense[^\s]+-security[, ]},
]
re = Regexp.union(security_matches)
%r{ gNewSense[^\s]+-security[, ]},
]
re = Regexp.union(security_matches)
- if line.match(re)
- apt_updates[1].push(package)
- end
+ apt_updates[1].push(package) if line.match(re)
end
end
end
end
end
end
@@
-35,9
+34,7
@@
Facter.add('apt_has_updates') do
confine osfamily: 'Debian'
setcode do
apt_package_updates = get_updates('upgrade')
confine osfamily: 'Debian'
setcode do
apt_package_updates = get_updates('upgrade')
- if !apt_package_updates.nil? && apt_package_updates.length == 2
- apt_package_updates != [[], []]
- end
+ apt_package_updates != [[], []] if !apt_package_updates.nil? && apt_package_updates.length == 2
end
end
end
end
@@
-45,9
+42,7
@@
Facter.add('apt_has_dist_updates') do
confine osfamily: 'Debian'
setcode do
apt_dist_updates = get_updates('dist-upgrade')
confine osfamily: 'Debian'
setcode do
apt_dist_updates = get_updates('dist-upgrade')
- if !apt_dist_updates.nil? && apt_dist_updates.length == 2
- apt_dist_updates != [[], []]
- end
+ apt_dist_updates != [[], []] if !apt_dist_updates.nil? && apt_dist_updates.length == 2
end
end
end
end