From 89be6dc2f6f705efce82fab4bfbd03059ee2b510 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 3 Sep 2009 13:54:28 -0400 Subject: remove 'backup => server' from config_file, as there is no such thing as 'server'. This didn't work as expected because of this error, and in some situations it caused problems (such as when ever file in a directory is considered a config file, such is the case with apt.conf.d ) --- manifests/defines/config_file.pp | 2 -- 1 file changed, 2 deletions(-) diff --git a/manifests/defines/config_file.pp b/manifests/defines/config_file.pp index 59208ac..781e9ec 100644 --- a/manifests/defines/config_file.pp +++ b/manifests/defines/config_file.pp @@ -37,8 +37,6 @@ define config_file ( { file { $name: ensure => $ensure, - # keep old versions on the server - backup => server, # default permissions for config files mode => 0644, owner => root, group => 0, # really detect changes to this file -- cgit v1.2.3 From 8a389425075f54f8c10e2ff08c1aa07827d14622 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 3 Sep 2009 13:57:47 -0400 Subject: fix indentation in line.pp example configuration snippet --- manifests/defines/line.pp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/manifests/defines/line.pp b/manifests/defines/line.pp index be5ec31..bc2ece4 100644 --- a/manifests/defines/line.pp +++ b/manifests/defines/line.pp @@ -14,12 +14,12 @@ # is a more stable solution with less maintenance headaches afterwards. # # Usage: -# line { -# description: -# file => "filename", -# line => "content", -# ensure => {absent,*present*} -# } +# line { +# description: +# file => "filename", +# line => "content", +# ensure => {absent,*present*} +# } # # Example: # The following ensures that the line "allow ^$munin_host$" exists in -- cgit v1.2.3 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 From 314af5320fd658c7423eb766b2b00a378a20dfb7 Mon Sep 17 00:00:00 2001 From: pietro Date: Fri, 27 Nov 2009 18:23:13 -0800 Subject: fix path to source file. --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index f767030..e0a9435 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,7 +13,7 @@ file { # for details "/var/lib/puppet/modules": ensure => directory, - source => "puppet://$server/modules/common/modules", + source => "puppet://$server/common/modules", ignore => ".ignore", recurse => true, purge => true, force => true, mode => 0755, owner => root, group => 0; -- cgit v1.2.3 From 1fa98d6183e77517e3ab851072e37e4235a3fe67 Mon Sep 17 00:00:00 2001 From: pietro Date: Fri, 27 Nov 2009 18:35:46 -0800 Subject: fix source path. --- manifests/defines/module_dir.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/defines/module_dir.pp b/manifests/defines/module_dir.pp index def5c94..d618f3e 100644 --- a/manifests/defines/module_dir.pp +++ b/manifests/defines/module_dir.pp @@ -9,7 +9,7 @@ # of puppet, the full path is /var/lib/puppet/modules/${name}. Every module # should # prefix its module_dirs with its name. # -# By default, the module_dir is loaded from "puppet:///${name}/module_dir". If +# By default, the module_dir is loaded from "puppet:///$server/${name}/module_dir". If # that doesn't exist an empty directory is taken as source. The directory is # purged so that modules do not have to worry about removing cruft. # @@ -27,7 +27,7 @@ define module_dir ( } else { file { $dir: - source => [ "puppet://$server/modules/${name}/module_dir", "puppet://$server/modules/common/empty"], + source => [ "puppet://$server/${name}/module_dir", "puppet://$server/common/empty"], checksum => mtime, # ignore the placeholder ignore => '\.ignore', -- cgit v1.2.3 From 6bd12511bb755993e4dc4f63d50877ad625d8510 Mon Sep 17 00:00:00 2001 From: pietro Date: Fri, 27 Nov 2009 18:58:20 -0800 Subject: Revert "fix path to source file." This reverts commit 314af5320fd658c7423eb766b2b00a378a20dfb7. --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index e0a9435..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://$server/common/modules", + source => "puppet://$server/modules/common/modules", ignore => ".ignore", recurse => true, purge => true, force => true, mode => 0755, owner => root, group => 0; -- cgit v1.2.3 From 76b0a31a76b8ab7509da3389379daa24b0610f73 Mon Sep 17 00:00:00 2001 From: pietro Date: Fri, 27 Nov 2009 18:58:39 -0800 Subject: Revert "fix source path." This reverts commit 1fa98d6183e77517e3ab851072e37e4235a3fe67. --- manifests/defines/module_dir.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/defines/module_dir.pp b/manifests/defines/module_dir.pp index d618f3e..def5c94 100644 --- a/manifests/defines/module_dir.pp +++ b/manifests/defines/module_dir.pp @@ -9,7 +9,7 @@ # of puppet, the full path is /var/lib/puppet/modules/${name}. Every module # should # prefix its module_dirs with its name. # -# By default, the module_dir is loaded from "puppet:///$server/${name}/module_dir". If +# By default, the module_dir is loaded from "puppet:///${name}/module_dir". If # that doesn't exist an empty directory is taken as source. The directory is # purged so that modules do not have to worry about removing cruft. # @@ -27,7 +27,7 @@ define module_dir ( } else { file { $dir: - source => [ "puppet://$server/${name}/module_dir", "puppet://$server/common/empty"], + source => [ "puppet://$server/modules/${name}/module_dir", "puppet://$server/modules/common/empty"], checksum => mtime, # ignore the placeholder ignore => '\.ignore', -- cgit v1.2.3