summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-12-07 18:16:37 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2015-12-07 18:16:37 -0800
commit812008eadb9a3b72ec2142db4a401cfe0b668f18 (patch)
tree897babda8bd6874db9a9b9fc294e1e1c30d569ba /lib
parent5085b5e365f6fb1052b658c107f6f1a322a12fbb (diff)
downloadchef-812008eadb9a3b72ec2142db4a401cfe0b668f18.tar.gz
restore handling of dpkg -s returns codes (w/tests)lcg/dpkg-s-return-codes
Previously dpkg -s would allow a 0 or 1 exit status and it wasn't entirely clear why this was so either from the code or the tests. This restores throwing an exception if we are outside of the [0,1] range, and then adds tests for both behaviors: - on old ubuntu/debian we get an exit(0) and output on stdout if the file is not installed - on newer ubuntu/debian we get an exit(1) and output on stderr if the file is not installed Added tests for both those cases, and the case where dpkg -s does some other kind of exitcode barf and we should raise.
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/package/dpkg.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/provider/package/dpkg.rb b/lib/chef/provider/package/dpkg.rb
index 35c55e366c..0da675e883 100644
--- a/lib/chef/provider/package/dpkg.rb
+++ b/lib/chef/provider/package/dpkg.rb
@@ -109,7 +109,7 @@ class Chef
def read_current_version_of_package(package_name)
Chef::Log.debug("#{new_resource} checking install state of #{package_name}")
- status = shell_out_with_timeout("dpkg -s #{package_name}")
+ status = shell_out_with_timeout!("dpkg -s #{package_name}", returns: [0, 1])
package_installed = false
status.stdout.each_line do |line|
case line