puppet 3.5.0.rc2-x86-mingw32 → 3.5.0.rc3-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

data/Gemfile CHANGED
@@ -21,7 +21,7 @@ end
21
21
  gem "puppet", :path => File.dirname(__FILE__), :require => false
22
22
  gem "facter", *location_for(ENV['FACTER_LOCATION'] || ['> 1.6', '< 3'])
23
23
  gem "hiera", *location_for(ENV['HIERA_LOCATION'] || '~> 1.0')
24
- gem "rake", :require => false
24
+ gem "rake", "10.1.1", :require => false
25
25
  gem "rgen", "0.6.5", :require => false
26
26
 
27
27
 
@@ -77,13 +77,20 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
77
77
  #NOTE: Prior to a fix for issue 1243, this method potentially returned a cached value
78
78
  #IF YOU CALL THIS METHOD, IT WILL CALL RPM
79
79
  #Use get(:property) to check if cached values are available
80
- cmd = ["-q", '--whatprovides', @resource[:name], "#{self.class.nosignature}", "#{self.class.nodigest}", "--qf", self.class::NEVRA_FORMAT]
80
+ cmd = ["-q", @resource[:name], "#{self.class.nosignature}", "#{self.class.nodigest}", "--qf", self.class::NEVRA_FORMAT]
81
81
 
82
82
  begin
83
83
  output = rpm(*cmd)
84
84
  rescue Puppet::ExecutionFailure
85
85
  # rpm -q exits 1 if package not found
86
- return nil
86
+ # retry the query for virtual packages
87
+ cmd << '--whatprovides'
88
+ begin
89
+ output = rpm(*cmd)
90
+ rescue Puppet::ExecutionFailure
91
+ # couldn't find a virtual package either
92
+ return nil
93
+ end
87
94
  end
88
95
  # FIXME: We could actually be getting back multiple packages
89
96
  # for multilib and this will only return the first such package
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  module Puppet
10
- PUPPETVERSION = '3.5.0-rc2'
10
+ PUPPETVERSION = '3.5.0-rc3'
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
@@ -16,14 +16,17 @@ describe Puppet::Type.type(:package).provider(:aptrpm) do
16
16
  Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "--version"], {:combine => true, :custom_environment => {}, :failonfail => true}).returns("4.10.1\n").at_most_once
17
17
  end
18
18
 
19
- def rpm
20
- pkg.provider.expects(:rpm).
21
- with('-q', '--whatprovides', 'faff', '--nosignature', '--nodigest', '--qf',
22
- "%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\\n")
19
+ def rpm_args
20
+ ['-q', 'faff', '--nosignature', '--nodigest', '--qf', "%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\\n"]
21
+ end
22
+
23
+ def rpm(args = rpm_args)
24
+ pkg.provider.expects(:rpm).with(*args)
23
25
  end
24
26
 
25
27
  it "should report absent packages" do
26
28
  rpm.raises(Puppet::ExecutionFailure, "couldn't find rpm")
29
+ rpm(rpm_args + ['--whatprovides']).raises(Puppet::ExecutionFailure, 'no package provides faff')
27
30
  pkg.property(:ensure).retrieve.should == :absent
28
31
  end
29
32
 
@@ -188,7 +188,7 @@ describe provider_class do
188
188
 
189
189
  describe "on a modern RPM" do
190
190
  before(:each) do
191
- Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "-q", "--whatprovides", "myresource", '--nosignature', '--nodigest', "--qf", nevra_format], execute_options).returns("myresource 0 1.2.3.4 5.el4 noarch\n")
191
+ Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "-q", "myresource", '--nosignature', '--nodigest', "--qf", nevra_format], execute_options).returns("myresource 0 1.2.3.4 5.el4 noarch\n")
192
192
  end
193
193
 
194
194
  let(:rpm_version) { "RPM version 4.10.0\n" }
@@ -201,7 +201,7 @@ describe provider_class do
201
201
 
202
202
  describe "on an ancient RPM" do
203
203
  before(:each) do
204
- Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "-q", "--whatprovides", "myresource", '', '', '--qf', nevra_format], execute_options).returns("myresource 0 1.2.3.4 5.el4 noarch\n")
204
+ Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "-q", "myresource", '', '', '--qf', nevra_format], execute_options).returns("myresource 0 1.2.3.4 5.el4 noarch\n")
205
205
  end
206
206
 
207
207
  let(:rpm_version) { "RPM version 3.0.6\n" }
@@ -214,7 +214,7 @@ describe provider_class do
214
214
 
215
215
  describe "when uninstalled with options" do
216
216
  before(:each) do
217
- Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "-q", "--whatprovides", "myresource", '--nosignature', '--nodigest', "--qf", nevra_format], execute_options).returns("myresource 0 1.2.3.4 5.el4 noarch\n")
217
+ Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "-q", "myresource", '--nosignature', '--nodigest', "--qf", nevra_format], execute_options).returns("myresource 0 1.2.3.4 5.el4 noarch\n")
218
218
  end
219
219
 
220
220
  let(:resource) do
@@ -236,7 +236,7 @@ describe provider_class do
236
236
  describe "parsing" do
237
237
  def parser_test(rpm_output_string, gold_hash, number_of_debug_logs = 0)
238
238
  Puppet.expects(:debug).times(number_of_debug_logs)
239
- Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "-q", "--whatprovides", resource_name, "--nosignature", "--nodigest", "--qf", nevra_format], execute_options).returns(rpm_output_string)
239
+ Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "-q", resource_name, "--nosignature", "--nodigest", "--qf", nevra_format], execute_options).returns(rpm_output_string)
240
240
  expect(provider.query).to eq(gold_hash)
241
241
  end
242
242
 
@@ -275,10 +275,27 @@ describe provider_class do
275
275
 
276
276
  it "does not log or fail if rpm returns package not found" do
277
277
  Puppet.expects(:debug).never
278
- Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "-q", "--whatprovides", resource_name, "--nosignature", "--nodigest", "--qf", nevra_format], execute_options).raises Puppet::ExecutionFailure.new('package not found')
279
-
278
+ expected_args = ["/bin/rpm", "-q", resource_name, "--nosignature", "--nodigest", "--qf", nevra_format]
279
+ Puppet::Util::Execution.expects(:execute).with(expected_args, execute_options).raises Puppet::ExecutionFailure.new("package #{resource_name} is not installed")
280
+ Puppet::Util::Execution.expects(:execute).with(expected_args + ["--whatprovides"], execute_options).raises Puppet::ExecutionFailure.new("no package provides #{resource_name}")
280
281
  expect(provider.query).to be_nil
281
282
  end
283
+
284
+ it "parses virtual package" do
285
+ #Puppet.expects(:debug).never
286
+ expected_args = ["/bin/rpm", "-q", resource_name, "--nosignature", "--nodigest", "--qf", nevra_format]
287
+ Puppet::Util::Execution.expects(:execute).with(expected_args, execute_options).raises Puppet::ExecutionFailure.new("package #{resource_name} is not installed")
288
+ Puppet::Util::Execution.expects(:execute).with(expected_args + ["--whatprovides"], execute_options).returns "myresource 0 1.2.3.4 5.el4 noarch\n"
289
+ expect(provider.query).to eq({
290
+ :name => "myresource",
291
+ :epoch => "0",
292
+ :version => "1.2.3.4",
293
+ :release => "5.el4",
294
+ :arch => "noarch",
295
+ :provider => :rpm,
296
+ :ensure => "1.2.3.4-5.el4"
297
+ })
298
+ end
282
299
  end
283
300
 
284
301
  describe "#install_options" do