Fix apt_has_updates fact not parsing apt-check output correctly
authorWolverineFan <github@uni-nets.com>
Thu, 8 Jan 2015 05:45:43 +0000 (00:45 -0500)
committerWolverineFan <github@uni-nets.com>
Fri, 16 Jan 2015 22:45:55 +0000 (17:45 -0500)
commite7fee16589fc478f4d73ea0782df975b03e4478b
tree693a832db18c23a1ab2d37a2329b442a178b9f77
parent6d60659e703293344884f0f41ec010bfc855f5a9
Fix apt_has_updates fact not parsing apt-check output correctly

The /usr/lib/update-notifier/apt-check script returns its output
to STDERR but a recent change to the script redirects STDERR to
/dev/null.  This will cause the array to always be empty.

Combined with that problem, while we were checking for the result
being nil, we never checked for an invalid array.  As a result,
the apt_has_updates was always true and the apt_updates and
apt_security_updates facts were trying to read from an empty array
and failing.
lib/facter/apt_updates.rb
spec/unit/facter/apt_has_updates_spec.rb
spec/unit/facter/apt_package_updates_spec.rb
spec/unit/facter/apt_security_updates_spec.rb
spec/unit/facter/apt_updates_spec.rb