From: Tollef Fog Heen Date: Sat, 1 Jul 2017 07:42:04 +0000 (+0200) Subject: Fix up tor fact to not complain if the package has been purged X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=5fd0bda656d408bccc971f644b09cde5c3dfc395;p=mirror%2Fdsa-puppet.git Fix up tor fact to not complain if the package has been purged `dpkg -l $package` will return 0 if the package has been purged, so a proper test for it instead. Also add a pair of quotes to make `dpkg --compare-versions` not complain. --- diff --git a/modules/debian_org/lib/facter/software.rb b/modules/debian_org/lib/facter/software.rb index 47fa46a81..b3b333319 100644 --- a/modules/debian_org/lib/facter/software.rb +++ b/modules/debian_org/lib/facter/software.rb @@ -154,6 +154,6 @@ Facter.add("systemd") do end Facter.add("tor_ge_0_2_9") do setcode do - system(%{dpkg -l tor >/dev/null 2>&1 && dpkg --compare-versions $(dpkg-query -W -f='${Version}' tor) ge 0.2.9}) + system(%{test -n "$(dpkg-query -W -f='${Version}' tor)" && dpkg --compare-versions "$(dpkg-query -W -f='${Version}' tor)" ge 0.2.9}) end end