From 5fd0bda656d408bccc971f644b09cde5c3dfc395 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Sat, 1 Jul 2017 09:42:04 +0200 Subject: [PATCH] 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. --- modules/debian_org/lib/facter/software.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.20.1