summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Wrock <matt@mattwrock.com>2016-07-01 11:48:59 -0700
committerMatt Wrock <matt@mattwrock.com>2016-07-01 11:48:59 -0700
commit268f937120942799e635328ef6e9ae7686b00dfc (patch)
tree1683e0a04f7de052aed05cddfcf8b9920adfdbc2
parentf60ce732ad3b9b287d5bf66dc89df9614d4277b5 (diff)
downloadchef-aix.tar.gz
fix candidate version and add unit testaix
-rw-r--r--lib/chef/provider/package/aix.rb7
-rw-r--r--spec/unit/provider/package/aix_spec.rb6
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/chef/provider/package/aix.rb b/lib/chef/provider/package/aix.rb
index 97400978db..6bbcdf8218 100644
--- a/lib/chef/provider/package/aix.rb
+++ b/lib/chef/provider/package/aix.rb
@@ -102,6 +102,9 @@ class Chef
@candidate_version = candidate
new_resource.version(candidate)
Chef::Log.debug("#{new_resource} setting install candidate version to #{@candidate_version}")
+ candidate
+ else
+ nil
end
end
end
@@ -146,6 +149,10 @@ class Chef
end
ret.stdout.each_line do |line|
case line
+ # installp will return lines with product:file_set:version
+ # So we are searching for products or filesets that match the package name
+ # Example line:
+ # samba.base:samba.base.rte:1.6.0.3::I:C:::::N:Network Authentication Service Client::::0::
when /(^|:)#{new_resource.package_name}:/
fields = line.split(":")
file_sets.push([fields[1], fields[2]])
diff --git a/spec/unit/provider/package/aix_spec.rb b/spec/unit/provider/package/aix_spec.rb
index b6b94d3fe0..95d6cb78e4 100644
--- a/spec/unit/provider/package/aix_spec.rb
+++ b/spec/unit/provider/package/aix_spec.rb
@@ -234,9 +234,11 @@ EOH
end
it "should lookup the candidate_version if the variable is not already set" do
- status = double(:stdout => "", :exitstatus => 0)
+ bffinfo = "/usr/lib/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:
+ /etc/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:"
+ status = double(:stdout => bffinfo, :exitstatus => 0)
expect(@provider).to receive(:shell_out).and_return(status)
- @provider.candidate_version
+ expect(@provider.candidate_version).to eq("3.3.12.0")
end
it "should throw and exception if the exitstatus is not 0" do