]> gitweb.fluxo.info Git - puppet-common.git/commitdiff
fix "fail on no ntp_ plugins" bug
authordavid <david@f03ff2f1-f02d-0410-970d-b9634babeaa1>
Tue, 7 Aug 2007 11:42:33 +0000 (11:42 +0000)
committerdavid <david@f03ff2f1-f02d-0410-970d-b9634babeaa1>
Tue, 7 Aug 2007 11:42:33 +0000 (11:42 +0000)
git-svn-id: http://club.black.co.at:82/svn/manifests/trunk@176 f03ff2f1-f02d-0410-970d-b9634babeaa1

files/functions/gsub.rb
files/functions/split.rb [new file with mode: 0755]
manifests/defines/concatenated_file.pp

index 743a7002cd5404e1e5e9d0406e4dd934e43d76c9..371820f2c7c77a071f9311be0afbb3e2cf7e6ce8 100644 (file)
@@ -1,7 +1,13 @@
 # generic gsub call
 module Puppet::Parser::Functions
        newfunction(:gsub, :type => :rvalue) do |args|
-               args[0].gsub(/#{args[1]}/, args[2])
+               if args[0].is_a?(Array)
+                       args[0].collect do |val|
+                               val.gsub(/#{args[1]}/, args[2])
+                       end
+               else
+                       args[0].gsub(/#{args[1]}/, args[2])
+               end
        end
 end
 
diff --git a/files/functions/split.rb b/files/functions/split.rb
new file mode 100755 (executable)
index 0000000..d08a40b
--- /dev/null
@@ -0,0 +1,7 @@
+# generic split call
+module Puppet::Parser::Functions
+       newfunction(:split, :type => :rvalue) do |args|
+               args[0].split(/#{args[1]}/)
+       end
+end
+
index e7014698157c87abd2029a952b88976c1878dd78..865a1eea6d5d3fe116a25d369f269e43272cd83e 100644 (file)
@@ -36,7 +36,16 @@ define concatenated_file (
        }
 
        # if there is a header or footer file, add it
-       $additional_cmd = "$header$footer" ? { '' => '', default => "| cat '${header}' - '${footer}' " }
+       $additional_cmd = "$header" ? {
+               '' => $footer ? {
+                       '' => '',
+                       default => "| cat - '${footer}' "
+               },
+               default => $footer ? { 
+                       '' => "| cat '${header}' - ",
+                       default => "| cat '${header}' - '${footer}' "
+               }
+       }
 
        # use >| to force clobbering the target file
        exec { "/usr/bin/find ${dir} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat ${header_cmd} >| ${name}.puppettmp":