From: Matthias Pigulla Date: Thu, 15 Dec 2011 14:52:21 +0000 (+0100) Subject: (#11413) Update dpkg query used by apt::force X-Git-Tag: 0.0.1~17^2~1 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2f5d317177976043dc3480ff715da5e1e56b8957;p=puppet-modules%2Fpuppetlabs-apt.git (#11413) Update dpkg query used by apt::force This patch fixes the query used by apt::force to determine rather or not the package is installed. Previously, the expression was not specific enough and could not lead to false positives in cases where a package name is contained within another package name (puppet could be incorrectly determined as being installed if puppet-common is installed) This commit resolves that by improving the query expression. --- diff --git a/manifests/force.pp b/manifests/force.pp index 0a3007d..ece532a 100644 --- a/manifests/force.pp +++ b/manifests/force.pp @@ -8,8 +8,8 @@ define apt::force( exec { "/usr/bin/aptitude -y -t ${release} install ${name}": unless => $version ? { - false => "/usr/bin/dpkg -l | grep ${name}", - default => "/usr/bin/dpkg -l | grep ${name} | grep ${version}" + false => "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'", + default => "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${version}'" } }