summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Wrock <matt@mattwrock.com>2016-07-08 11:37:21 -0700
committerGitHub <noreply@github.com>2016-07-08 11:37:21 -0700
commita24deb8a2c5d642d831d9b22dec6be0f4a9f0182 (patch)
tree53f182508e05034fa506871cf44fc53944158e0a
parent4b4d26161050591b6ee3a55786ed56f0ab656767 (diff)
parentb325c3a1da57717df3de7bfbc1ce22a0f3505958 (diff)
downloadchef-a24deb8a2c5d642d831d9b22dec6be0f4a9f0182.tar.gz
Merge pull request #5093 from chef/aix2
Warn if not installing an individual bff fileset
-rw-r--r--lib/chef/provider/package/aix.rb6
-rw-r--r--spec/unit/provider/package/aix_spec.rb13
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/chef/provider/package/aix.rb b/lib/chef/provider/package/aix.rb
index a1709c4af7..728f181055 100644
--- a/lib/chef/provider/package/aix.rb
+++ b/lib/chef/provider/package/aix.rb
@@ -55,7 +55,11 @@ class Chef
ret = shell_out_with_timeout("installp -L -d #{@new_resource.source}")
ret.stdout.each_line do |line|
case line
- when /#{@new_resource.package_name}:/
+ when /:#{@new_resource.package_name}:/
+ fields = line.split(":")
+ @new_resource.version(fields[2])
+ when /^#{@new_resource.package_name}:/
+ Chef::Log.warn("You are installing a bff package by product name. For idempotent installs, please install individual filesets")
fields = line.split(":")
@new_resource.version(fields[2])
end
diff --git a/spec/unit/provider/package/aix_spec.rb b/spec/unit/provider/package/aix_spec.rb
index 6940874a43..2b574bb7df 100644
--- a/spec/unit/provider/package/aix_spec.rb
+++ b/spec/unit/provider/package/aix_spec.rb
@@ -73,6 +73,19 @@ describe Chef::Provider::Package::Aix do
expect(@new_resource.version).to eq("3.3.12.0")
end
+ it "should warn if the package is not a fileset" do
+ info = "samba.base:samba.base.samples:3.3.12.0::COMMITTED:I:Samba for AIX:
+ /etc/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:"
+ status = double("Status", :stdout => info, :exitstatus => 0)
+ expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
+ expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status)
+ expect(Chef::Log).to receive(:warn).once.with(%r{bff package by product name})
+ @provider.load_current_resource
+
+ expect(@provider.current_resource.package_name).to eq("samba.base")
+ expect(@new_resource.version).to eq("3.3.12.0")
+ end
+
it "should return the current version installed if found by lslpp" do
status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
@stdout = StringIO.new(@bffinfo)