From 3ff12051c8efabcdfb43b99810ff1c2ea22750a3 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 23 Nov 2009 11:54:04 -0500 Subject: move plugin directory to fit new 0.25.x style and update file paths accordingly --- lib/puppet/parser/functions/basename.rb | 22 ++++++++++++++++++++++ lib/puppet/parser/functions/dirname.rb | 22 ++++++++++++++++++++++ lib/puppet/parser/functions/gsub.rb | 21 +++++++++++++++++++++ lib/puppet/parser/functions/prefix_with.rb | 19 +++++++++++++++++++ lib/puppet/parser/functions/re_escape.rb | 7 +++++++ lib/puppet/parser/functions/split.rb | 23 +++++++++++++++++++++++ manifests/defines/concatenated_file.pp | 2 +- manifests/defines/module_dir.pp | 2 +- manifests/init.pp | 2 +- plugins/puppet/parser/functions/basename.rb | 22 ---------------------- plugins/puppet/parser/functions/dirname.rb | 22 ---------------------- plugins/puppet/parser/functions/gsub.rb | 21 --------------------- plugins/puppet/parser/functions/prefix_with.rb | 19 ------------------- plugins/puppet/parser/functions/re_escape.rb | 7 ------- plugins/puppet/parser/functions/split.rb | 23 ----------------------- 15 files changed, 117 insertions(+), 117 deletions(-) create mode 100644 lib/puppet/parser/functions/basename.rb create mode 100644 lib/puppet/parser/functions/dirname.rb create mode 100644 lib/puppet/parser/functions/gsub.rb create mode 100644 lib/puppet/parser/functions/prefix_with.rb create mode 100644 lib/puppet/parser/functions/re_escape.rb create mode 100644 lib/puppet/parser/functions/split.rb delete mode 100644 plugins/puppet/parser/functions/basename.rb delete mode 100644 plugins/puppet/parser/functions/dirname.rb delete mode 100644 plugins/puppet/parser/functions/gsub.rb delete mode 100644 plugins/puppet/parser/functions/prefix_with.rb delete mode 100644 plugins/puppet/parser/functions/re_escape.rb delete mode 100644 plugins/puppet/parser/functions/split.rb diff --git a/lib/puppet/parser/functions/basename.rb b/lib/puppet/parser/functions/basename.rb new file mode 100644 index 0000000..dc72537 --- /dev/null +++ b/lib/puppet/parser/functions/basename.rb @@ -0,0 +1,22 @@ +# This function has two modes of operation: +# +# basename(string) : string +# +# Returns the last component of the filename given as argument, which must be +# formed using forward slashes ("/") regardless of the separator used on the +# local file system. +# +# basename(string[]) : string[] +# +# Returns an array of strings with the basename of each item from the argument. +# +module Puppet::Parser::Functions + newfunction(:basename, :type => :rvalue) do |args| + if args[0].is_a?(Array) + args.collect do |a| File.basename(a) end + else + File.basename(args[0]) + end + end +end + diff --git a/lib/puppet/parser/functions/dirname.rb b/lib/puppet/parser/functions/dirname.rb new file mode 100644 index 0000000..ea0d50b --- /dev/null +++ b/lib/puppet/parser/functions/dirname.rb @@ -0,0 +1,22 @@ +# This function has two modes of operation: +# +# dirname(string) : string +# +# Returns all components of the filename given as argument except the last +# one. The filename must be formed using forward slashes (``/..) regardless of +# the separator used on the local file system. +# +# dirname(string[]) : string[] +# +# Returns an array of strings with the basename of each item from the argument. +# +module Puppet::Parser::Functions + newfunction(:dirname, :type => :rvalue) do |args| + if args[0].is_a?(Array) + args.collect do |a| File.dirname(a) end + else + File.dirname(args[0]) + end + end +end + diff --git a/lib/puppet/parser/functions/gsub.rb b/lib/puppet/parser/functions/gsub.rb new file mode 100644 index 0000000..27e6192 --- /dev/null +++ b/lib/puppet/parser/functions/gsub.rb @@ -0,0 +1,21 @@ +# +# A thin wrapper around the ruby gsub function. +# +# gsub($string, $pattern, $replacement) +# +# will replace all occurrences of $pattern in $string with $replacement. +# $string can be either a single value or an array. In the latter case, each +# element of the array will be processed in turn. +# +module Puppet::Parser::Functions + newfunction(:gsub, :type => :rvalue) do |args| + 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/lib/puppet/parser/functions/prefix_with.rb b/lib/puppet/parser/functions/prefix_with.rb new file mode 100644 index 0000000..5a12986 --- /dev/null +++ b/lib/puppet/parser/functions/prefix_with.rb @@ -0,0 +1,19 @@ +# Prefixes arguments 2..n with first argument. +# +# prefix_with(string prefix, string[] arguments) : string[] +# +# Example: +# +# prefix_with("php-", [ "blah", "foo" ]) +# +# will result in this array: +# +# [ "php-blah", "php-foo" ] +# +module Puppet::Parser::Functions + newfunction(:prefix_with, :type => :rvalue) do |args| + prefix = args.shift + args.collect {|v| "%s%s" % [prefix, v] } + end +end + diff --git a/lib/puppet/parser/functions/re_escape.rb b/lib/puppet/parser/functions/re_escape.rb new file mode 100644 index 0000000..7bee90a --- /dev/null +++ b/lib/puppet/parser/functions/re_escape.rb @@ -0,0 +1,7 @@ +# apply ruby regexp escaping to a string +module Puppet::Parser::Functions + newfunction(:re_escape, :type => :rvalue) do |args| + Regexp.escape(args[0]) + end +end + diff --git a/lib/puppet/parser/functions/split.rb b/lib/puppet/parser/functions/split.rb new file mode 100644 index 0000000..bffecc1 --- /dev/null +++ b/lib/puppet/parser/functions/split.rb @@ -0,0 +1,23 @@ +# This function has two modes of operation: +# +# split($string, $delimiter) : $string +# +# Split the first argument on every $delimiter. $delimiter is interpreted as +# Ruby regular expression. +# +# split($string[], $delimiter) : $string[][] +# +# Returns an array of split results with the result of applying split to each +# item from the first argument. +# +# For long-term portability it is recommended to refrain from using Ruby's +# extended RE features. +module Puppet::Parser::Functions + newfunction(:split, :type => :rvalue) do |args| + if args[0].is_a?(Array) + args.collect do |a| a.split(/#{args[1]}/) end + else + args[0].split(/#{args[1]}/) + end + end +end diff --git a/manifests/defines/concatenated_file.pp b/manifests/defines/concatenated_file.pp index 8ae855c..b85456c 100644 --- a/manifests/defines/concatenated_file.pp +++ b/manifests/defines/concatenated_file.pp @@ -51,7 +51,7 @@ define concatenated_file ( } else { file { $dir_real: - source => "puppet:///common/empty", + source => "puppet://$server/modules/common/empty", checksum => mtime, ignore => '.ignore', recurse => true, purge => true, force => true, diff --git a/manifests/defines/module_dir.pp b/manifests/defines/module_dir.pp index 5b2d340..def5c94 100644 --- a/manifests/defines/module_dir.pp +++ b/manifests/defines/module_dir.pp @@ -27,7 +27,7 @@ define module_dir ( } else { file { $dir: - source => [ "puppet:///${name}/module_dir", "puppet:///common/empty"], + source => [ "puppet://$server/modules/${name}/module_dir", "puppet://$server/modules/common/empty"], checksum => mtime, # ignore the placeholder ignore => '\.ignore', diff --git a/manifests/init.pp b/manifests/init.pp index f7298e3..f767030 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,7 +13,7 @@ file { # for details "/var/lib/puppet/modules": ensure => directory, - source => "puppet:///common/modules", + source => "puppet://$server/modules/common/modules", ignore => ".ignore", recurse => true, purge => true, force => true, mode => 0755, owner => root, group => 0; diff --git a/plugins/puppet/parser/functions/basename.rb b/plugins/puppet/parser/functions/basename.rb deleted file mode 100644 index dc72537..0000000 --- a/plugins/puppet/parser/functions/basename.rb +++ /dev/null @@ -1,22 +0,0 @@ -# This function has two modes of operation: -# -# basename(string) : string -# -# Returns the last component of the filename given as argument, which must be -# formed using forward slashes ("/") regardless of the separator used on the -# local file system. -# -# basename(string[]) : string[] -# -# Returns an array of strings with the basename of each item from the argument. -# -module Puppet::Parser::Functions - newfunction(:basename, :type => :rvalue) do |args| - if args[0].is_a?(Array) - args.collect do |a| File.basename(a) end - else - File.basename(args[0]) - end - end -end - diff --git a/plugins/puppet/parser/functions/dirname.rb b/plugins/puppet/parser/functions/dirname.rb deleted file mode 100644 index ea0d50b..0000000 --- a/plugins/puppet/parser/functions/dirname.rb +++ /dev/null @@ -1,22 +0,0 @@ -# This function has two modes of operation: -# -# dirname(string) : string -# -# Returns all components of the filename given as argument except the last -# one. The filename must be formed using forward slashes (``/..) regardless of -# the separator used on the local file system. -# -# dirname(string[]) : string[] -# -# Returns an array of strings with the basename of each item from the argument. -# -module Puppet::Parser::Functions - newfunction(:dirname, :type => :rvalue) do |args| - if args[0].is_a?(Array) - args.collect do |a| File.dirname(a) end - else - File.dirname(args[0]) - end - end -end - diff --git a/plugins/puppet/parser/functions/gsub.rb b/plugins/puppet/parser/functions/gsub.rb deleted file mode 100644 index 27e6192..0000000 --- a/plugins/puppet/parser/functions/gsub.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# A thin wrapper around the ruby gsub function. -# -# gsub($string, $pattern, $replacement) -# -# will replace all occurrences of $pattern in $string with $replacement. -# $string can be either a single value or an array. In the latter case, each -# element of the array will be processed in turn. -# -module Puppet::Parser::Functions - newfunction(:gsub, :type => :rvalue) do |args| - 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/plugins/puppet/parser/functions/prefix_with.rb b/plugins/puppet/parser/functions/prefix_with.rb deleted file mode 100644 index 5a12986..0000000 --- a/plugins/puppet/parser/functions/prefix_with.rb +++ /dev/null @@ -1,19 +0,0 @@ -# Prefixes arguments 2..n with first argument. -# -# prefix_with(string prefix, string[] arguments) : string[] -# -# Example: -# -# prefix_with("php-", [ "blah", "foo" ]) -# -# will result in this array: -# -# [ "php-blah", "php-foo" ] -# -module Puppet::Parser::Functions - newfunction(:prefix_with, :type => :rvalue) do |args| - prefix = args.shift - args.collect {|v| "%s%s" % [prefix, v] } - end -end - diff --git a/plugins/puppet/parser/functions/re_escape.rb b/plugins/puppet/parser/functions/re_escape.rb deleted file mode 100644 index 7bee90a..0000000 --- a/plugins/puppet/parser/functions/re_escape.rb +++ /dev/null @@ -1,7 +0,0 @@ -# apply ruby regexp escaping to a string -module Puppet::Parser::Functions - newfunction(:re_escape, :type => :rvalue) do |args| - Regexp.escape(args[0]) - end -end - diff --git a/plugins/puppet/parser/functions/split.rb b/plugins/puppet/parser/functions/split.rb deleted file mode 100644 index bffecc1..0000000 --- a/plugins/puppet/parser/functions/split.rb +++ /dev/null @@ -1,23 +0,0 @@ -# This function has two modes of operation: -# -# split($string, $delimiter) : $string -# -# Split the first argument on every $delimiter. $delimiter is interpreted as -# Ruby regular expression. -# -# split($string[], $delimiter) : $string[][] -# -# Returns an array of split results with the result of applying split to each -# item from the first argument. -# -# For long-term portability it is recommended to refrain from using Ruby's -# extended RE features. -module Puppet::Parser::Functions - newfunction(:split, :type => :rvalue) do |args| - if args[0].is_a?(Array) - args.collect do |a| a.split(/#{args[1]}/) end - else - args[0].split(/#{args[1]}/) - end - end -end -- cgit v1.2.3