summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Wrock <matt@mattwrock.com>2016-07-07 16:21:08 -0700
committerMatt Wrock <matt@mattwrock.com>2016-07-07 16:21:08 -0700
commitb325c3a1da57717df3de7bfbc1ce22a0f3505958 (patch)
treec5033bd1fac6eb7b6e3100d37cd71dfccfcd950c
parentdfe3498c68da48362b6bf8d558ecd3386702cd45 (diff)
downloadchef-aix2.tar.gz
warn if not installing an individual bff filesetaix2
-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)