summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-10-02 01:14:03 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-10-02 01:14:17 -0700
commitce9a6f97ab1784d8bd60eae8b60272c9875b1f84 (patch)
treeba2e2fe2d56b813e93133683bab006abf28d6cc5
parentc6e824ad5144957e351892a1d745a127b02f34b3 (diff)
parent8cd1540f82cbdf903c164bdbc2c7229e34a4178b (diff)
downloadpuppet-ce9a6f97ab1784d8bd60eae8b60272c9875b1f84.tar.gz
puppet-ce9a6f97ab1784d8bd60eae8b60272c9875b1f84.tar.xz
puppet-ce9a6f97ab1784d8bd60eae8b60272c9875b1f84.zip
Partial merge to 2.6.2rc1 : Merge commit '8cd1540' into next
There are merge conflicts with commits following this one.
-rw-r--r--lib/puppet/parser/ast/function.rb2
-rw-r--r--lib/puppet/provider/service/freebsd.rb2
-rw-r--r--lib/puppet/type.rb6
-rwxr-xr-xlib/puppet/type/tidy.rb1
-rw-r--r--spec/unit/parser/ast/function_spec.rb18
-rwxr-xr-xspec/unit/type_spec.rb7
6 files changed, 27 insertions, 9 deletions
diff --git a/lib/puppet/parser/ast/function.rb b/lib/puppet/parser/ast/function.rb
index 74023f631..80e6e6512 100644
--- a/lib/puppet/parser/ast/function.rb
+++ b/lib/puppet/parser/ast/function.rb
@@ -28,7 +28,7 @@ class Puppet::Parser::AST
end
# We don't need to evaluate the name, because it's plaintext
- args = @arguments.safeevaluate(scope)
+ args = @arguments.safeevaluate(scope).map { |x| x == :undef ? '' : x }
scope.send("function_#{@name}", args)
end
diff --git a/lib/puppet/provider/service/freebsd.rb b/lib/puppet/provider/service/freebsd.rb
index 10970e4da..c75c3c9ab 100644
--- a/lib/puppet/provider/service/freebsd.rb
+++ b/lib/puppet/provider/service/freebsd.rb
@@ -78,7 +78,7 @@ Puppet::Type.type(:service).provide :freebsd, :parent => :init do
# Add a new setting to the rc files
def rc_add(service, rcvar, yesno)
- append = "\n\# Added by Puppet\n#{rcvar}_enable=\"#{yesno}\""
+ append = "\# Added by Puppet\n#{rcvar}_enable=\"#{yesno}\"\n"
# First, try the one-file-per-service style
if File.exists?(@@rcconf_dir)
File.open(@@rcconf_dir + "/#{service}", File::WRONLY | File::APPEND | File::CREAT, 0644) {
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index f9aacece8..1b6e7dcd7 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -965,7 +965,7 @@ class Type
the value, and any changes already get logged."
validate do |list|
- list = Array(list)
+ list = Array(list).collect {|p| p.to_sym}
unless list == [:all]
list.each do |param|
next if @resource.class.validattr?(param)
@@ -990,8 +990,8 @@ class Type
end
def properties_to_audit(list)
- if list == :all
- list = all_properties if list == :all
+ if !list.kind_of?(Array) && list.to_sym == :all
+ list = all_properties
else
list = Array(list).collect { |p| p.to_sym }
end
diff --git a/lib/puppet/type/tidy.rb b/lib/puppet/type/tidy.rb
index 64a7a1a88..65cc077cf 100755
--- a/lib/puppet/type/tidy.rb
+++ b/lib/puppet/type/tidy.rb
@@ -1,5 +1,6 @@
Puppet::Type.newtype(:tidy) do
require 'puppet/file_serving/fileset'
+ require 'puppet/file_bucket/dipper'
@doc = "Remove unwanted files based on specific criteria. Multiple
criteria are OR'd together, so a file that is too large but is not
diff --git a/spec/unit/parser/ast/function_spec.rb b/spec/unit/parser/ast/function_spec.rb
index c57c7f098..38e344157 100644
--- a/spec/unit/parser/ast/function_spec.rb
+++ b/spec/unit/parser/ast/function_spec.rb
@@ -61,20 +61,30 @@ describe Puppet::Parser::AST::Function do
end
it "should call the underlying ruby function" do
- argument = stub 'arg', :safeevaluate => "nothing"
+ argument = stub 'arg', :safeevaluate => ["nothing"]
Puppet::Parser::Functions.stubs(:function).with("exist").returns(true)
func = Puppet::Parser::AST::Function.new :name => "exist", :ftype => :statement, :arguments => argument
- @scope.expects(:function_exist).with("nothing")
+ @scope.expects(:function_exist).with(["nothing"])
+
+ func.evaluate(@scope)
+ end
+
+ it "should convert :undef to '' in arguments" do
+ argument = stub 'arg', :safeevaluate => ["foo", :undef, "bar"]
+ Puppet::Parser::Functions.stubs(:function).with("exist").returns(true)
+ func = Puppet::Parser::AST::Function.new :name => "exist", :ftype => :statement, :arguments => argument
+
+ @scope.expects(:function_exist).with(["foo", "", "bar"])
func.evaluate(@scope)
end
it "should return the ruby function return for rvalue functions" do
- argument = stub 'arg', :safeevaluate => "nothing"
+ argument = stub 'arg', :safeevaluate => ["nothing"]
Puppet::Parser::Functions.stubs(:function).with("exist").returns(true)
func = Puppet::Parser::AST::Function.new :name => "exist", :ftype => :statement, :arguments => argument
- @scope.stubs(:function_exist).with("nothing").returns("returning")
+ @scope.stubs(:function_exist).with(["nothing"]).returns("returning")
func.evaluate(@scope).should == "returning"
end
diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb
index 487750e52..48b00ec4a 100755
--- a/spec/unit/type_spec.rb
+++ b/spec/unit/type_spec.rb
@@ -545,6 +545,13 @@ describe Puppet::Type.metaparamclass(:audit) do
@resource[:audit].should == list
end
+ it "should accept the string 'all' to specify auditing all possible properties" do
+ @resource[:audit] = 'all'
+
+ list = @resource.class.properties.collect { |p| p.name }
+ @resource[:audit].should == list
+ end
+
it "should fail if asked to audit an invalid property" do
lambda { @resource[:audit] = :foobar }.should raise_error(Puppet::Error)
end