diff options
author | Daniel Schauenberg <d@unwiredcouch.com> | 2021-01-01 22:58:01 +0100 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2021-01-12 13:02:49 -0800 |
commit | d89d3f0374a4e3027203df6ebcf21f690f263fc6 (patch) | |
tree | 66908434808b247e86c7ad25a7977346d828eff7 | |
parent | 8284d9c32850e55bc8138f9d74af5e2f94cc8d7d (diff) | |
download | chef-d89d3f0374a4e3027203df6ebcf21f690f263fc6.tar.gz |
adapt to FreeBSD pkgng sysexit changes
Signed-off-by: Daniel Schauenberg <d@unwiredcouch.com>
-rw-r--r-- | lib/chef/provider/package/freebsd/pkgng.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/package/freebsd/pkgng_spec.rb | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/chef/provider/package/freebsd/pkgng.rb b/lib/chef/provider/package/freebsd/pkgng.rb index 87acb3a830..077464b5c2 100644 --- a/lib/chef/provider/package/freebsd/pkgng.rb +++ b/lib/chef/provider/package/freebsd/pkgng.rb @@ -42,7 +42,9 @@ class Chef end def current_installed_version - pkg_info = shell_out!("pkg", "info", new_resource.package_name, env: nil, returns: [0, 70]) + # pkgng up to version 1.15.99.7 returns 70 for pkg not found, + # later versions return 1 + pkg_info = shell_out!("pkg", "info", new_resource.package_name, env: nil, returns: [0, 1, 70]) pkg_info.stdout[/^Version +: (.+)$/, 1] end diff --git a/spec/unit/provider/package/freebsd/pkgng_spec.rb b/spec/unit/provider/package/freebsd/pkgng_spec.rb index bc78a178eb..ce5d58b7dc 100644 --- a/spec/unit/provider/package/freebsd/pkgng_spec.rb +++ b/spec/unit/provider/package/freebsd/pkgng_spec.rb @@ -66,7 +66,7 @@ describe Chef::Provider::Package::Freebsd::Port do end it "should query pkg database" do - expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "zsh", env: nil, returns: [0, 70], timeout: 900).and_return(@pkg_info) + expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "zsh", env: nil, returns: [0, 1, 70], timeout: 900).and_return(@pkg_info) expect(@provider.current_installed_version).to eq("3.1.7") end end |