[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Jesse Wolfe
jes5199 at gmail.com
Tue May 10 08:08:43 UTC 2011
The following commit has been merged in the experimental branch:
commit cc43dd79ad8d40b5b7bf3f4480ff794e99f733a4
Merge: c0236aab1145e01e26f59cf1d823dc6966ba567b 0fec21fcd887685cf8421fdc309b878088f9fc48
Author: Jesse Wolfe <jes5199 at gmail.com>
Date: Fri Mar 25 16:24:01 2011 -0700
Merge commit '2.6.next^1' into next
These changes were superseded by existing commits in next:
lib/puppet/parser/compiler.rb
spec/unit/parser/compiler_spec.rb
diff --combined lib/puppet/type/exec.rb
index 773df2b,be0ece0..3ba488f
--- a/lib/puppet/type/exec.rb
+++ b/lib/puppet/type/exec.rb
@@@ -201,6 -201,15 +201,6 @@@ module Puppe
end
end
- newparam(:env) do
- desc "This parameter is deprecated. Use 'environment' instead."
-
- munge do |value|
- warning "'env' is deprecated on exec; use 'environment' instead."
- resource[:environment] = value
- end
- end
-
newparam(:environment) do
desc "Any additional environment variables you want to set for a
command. Note that if you use this to set PATH, it will override
@@@ -220,19 -229,17 +220,17 @@@
newparam(:timeout) do
desc "The maximum time the command should take. If the command takes
longer than the timeout, the command is considered to have failed
- and will be stopped. Use any negative number to disable the timeout.
+ and will be stopped. Use 0 to disable the timeout.
The time is specified in seconds."
munge do |value|
value = value.shift if value.is_a?(Array)
- if value.is_a?(String)
- unless value =~ /^[-\d.]+$/
- raise ArgumentError, "The timeout must be a number."
- end
- Float(value)
- else
- value
+ begin
+ value = Float(value)
+ rescue ArgumentError => e
+ raise ArgumentError, "The timeout must be a number."
end
+ [value, 0.0].max
end
defaultto 300
diff --combined spec/unit/file_serving/fileset_spec.rb
index 1ef9cdc,149c68c..3b12c95
--- a/spec/unit/file_serving/fileset_spec.rb
+++ b/spec/unit/file_serving/fileset_spec.rb
@@@ -1,6 -1,6 +1,6 @@@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../spec_helper'
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require 'puppet/file_serving/fileset'
@@@ -13,6 -13,14 +13,14 @@@ describe Puppet::FileServing::Fileset,
proc { Puppet::FileServing::Fileset.new("some/file") }.should raise_error(ArgumentError)
end
+ it "should not fail if the path is fully qualified, with a trailing separator" do
+ path = "/some/path/with/trailing/separator"
+ path_with_separator = "#{path}#{File::SEPARATOR}"
+ File.stubs(:lstat).with(path).returns stub('stat')
+ fileset = Puppet::FileServing::Fileset.new(path_with_separator)
+ fileset.path.should == path
+ end
+
it "should fail if its path does not exist" do
File.expects(:lstat).with("/some/file").returns nil
proc { Puppet::FileServing::Fileset.new("/some/file") }.should raise_error(ArgumentError)
diff --combined spec/unit/type/exec_spec.rb
index a1ffb16,e155506..86b8244
--- a/spec/unit/type/exec_spec.rb
+++ b/spec/unit/type/exec_spec.rb
@@@ -1,6 -1,5 +1,6 @@@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../spec_helper'
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe Puppet::Type.type(:exec) do
def exec_tester(command, exitstatus = 0, rest = {})
@@@ -285,6 -284,36 +285,6 @@@
@exec = Puppet::Type.type(:exec).new(:name => '/bin/true')
end
- describe "when setting env" do
- it "should issue a deprecation warning" do
- expect { @exec[:env] = 'foo=bar' }.should_not raise_error
- @logs.first.message.should =~ /deprecate.*environment/
- end
-
- it "should update the value of env" do
- data = ['foo=bar']
- @exec[:env] = data
- @exec[:env].should == data
- end
-
- it "should forward to environment" do
- data = ['foo=bar']
- @exec[:env] = data
- @exec[:environment].should == data
- end
-
- it "should not override environment if both are set" do
- pending "can't fix: too disruptive for 2.6, removed in 2.7"
- # ...so this test is here to validate that we know about the problem.
- # This ensures correct order of evaluation to trigger the bug; don't
- # count on this happening in the constructor. --daniel 2011-03-01
- @exec[:environment] = 'environment=true'
- @exec[:env] = 'env=true'
-
- @exec[:environment].should == "environment=true"
- end
- end
-
describe "when setting environment" do
{ "single values" => "foo=bar",
"multiple values" => ["foo=bar", "baz=quux"],
@@@ -307,7 -336,7 +307,7 @@@
end
describe "when setting timeout" do
- [-3.5, -1, 0, 0.1, 1, 10, 4294967295].each do |valid|
+ [0, 0.1, 1, 10, 4294967295].each do |valid|
it "should accept '#{valid}' as valid" do
@exec[:timeout] = valid
@exec[:timeout].should == valid
@@@ -319,7 -348,7 +319,7 @@@
end
end
- ['1/2', '1_000_000', '+12', '', 'foo'].each do |invalid|
+ ['1/2', '', 'foo', '5foo'].each do |invalid|
it "should reject '#{invalid}' as invalid" do
expect { @exec[:timeout] = invalid }.
should raise_error Puppet::Error, /The timeout must be a number/
@@@ -337,6 -366,18 +337,18 @@@
sleep_exec = Puppet::Type.type(:exec).new(:name => 'sleep 1', :path => ['/bin'], :timeout => '0.2')
lambda { sleep_exec.refresh }.should raise_error Puppet::Error, "Command exceeded timeout"
end
+
+ it "should convert timeout to a float" do
+ resource = Puppet::Type.type(:exec).new :command => "/bin/false", :timeout => "12"
+ resource[:timeout].should be_a(Float)
+ resource[:timeout].should == 12.0
+ end
+
+ it "should munge negative timeouts to 0.0" do
+ resource = Puppet::Type.type(:exec).new :command => "/bin/false", :timeout => "-12.0"
+ resource.parameter(:timeout).value.should be_a(Float)
+ resource.parameter(:timeout).value.should == 0.0
+ end
end
describe "when setting tries" do
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list