summaryrefslogtreecommitdiff
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/functions/basename.rb22
-rw-r--r--lib/puppet/parser/functions/dirname.rb22
-rw-r--r--lib/puppet/parser/functions/get_default.rb15
-rw-r--r--lib/puppet/parser/functions/hostname.rb13
-rw-r--r--lib/puppet/parser/functions/multi_source_template.rb29
-rw-r--r--lib/puppet/parser/functions/prefix_with.rb9
-rw-r--r--lib/puppet/parser/functions/re_escape.rb7
-rw-r--r--lib/puppet/parser/functions/slash_escape.rb7
-rw-r--r--lib/puppet/parser/functions/substitute.rb20
-rw-r--r--lib/puppet/parser/functions/tfile.rb19
10 files changed, 0 insertions, 163 deletions
diff --git a/lib/puppet/parser/functions/basename.rb b/lib/puppet/parser/functions/basename.rb
deleted file mode 100644
index dc725375..00000000
--- a/lib/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/lib/puppet/parser/functions/dirname.rb b/lib/puppet/parser/functions/dirname.rb
deleted file mode 100644
index ea0d50b4..00000000
--- a/lib/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/lib/puppet/parser/functions/get_default.rb b/lib/puppet/parser/functions/get_default.rb
deleted file mode 100644
index 3f4359bd..00000000
--- a/lib/puppet/parser/functions/get_default.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# get_default($value, $default) : $value
-#
-# return $value || $default.
-module Puppet::Parser::Functions
- newfunction(:get_default, :type => :rvalue) do |args|
- value = nil
- args.each { |x|
- if ! x.nil? and x.length > 0
- value = x
- break
- end
- }
- return value
- end
-end
diff --git a/lib/puppet/parser/functions/hostname.rb b/lib/puppet/parser/functions/hostname.rb
deleted file mode 100644
index 7bc477f2..00000000
--- a/lib/puppet/parser/functions/hostname.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# get an uniq array of ipaddresses for a hostname
-require 'resolv'
-
-module Puppet::Parser::Functions
- newfunction(:hostname, :type => :rvalue) do |args|
- res = Array.new
- Resolv::DNS.new.each_address(args[0]){ |addr|
- res << addr
- }
- res.uniq
- end
-end
-
diff --git a/lib/puppet/parser/functions/multi_source_template.rb b/lib/puppet/parser/functions/multi_source_template.rb
deleted file mode 100644
index e0753205..00000000
--- a/lib/puppet/parser/functions/multi_source_template.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-module Puppet::Parser::Functions
- require 'erb'
-
- newfunction(:multi_source_template, :type => :rvalue) do |args|
- contents = nil
- environment = compiler.environment
- sources = args
-
- sources.each do |file|
- Puppet.debug("Looking for #{file} in #{environment}")
- if filename = Puppet::Parser::Files.find_template(file, environment.to_s)
- wrapper = Puppet::Parser::TemplateWrapper.new(self)
- wrapper.file = file
-
- begin
- contents = wrapper.result
- rescue => detail
- raise Puppet::ParseError, "Failed to parse template %s: %s" % [file, detail]
- end
-
- break
- end
- end
-
- raise Puppet::ParseError, "multi_source_template: No match found for files: #{sources.join(', ')}" if contents == nil
-
- contents
- end
-end
diff --git a/lib/puppet/parser/functions/prefix_with.rb b/lib/puppet/parser/functions/prefix_with.rb
deleted file mode 100644
index 6e64a4a8..00000000
--- a/lib/puppet/parser/functions/prefix_with.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# prefix arguments 2..n with first argument
-
-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
deleted file mode 100644
index 7bee90a8..00000000
--- a/lib/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/lib/puppet/parser/functions/slash_escape.rb b/lib/puppet/parser/functions/slash_escape.rb
deleted file mode 100644
index 04d3b95e..00000000
--- a/lib/puppet/parser/functions/slash_escape.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# escape slashes in a String
-module Puppet::Parser::Functions
- newfunction(:slash_escape, :type => :rvalue) do |args|
- args[0].gsub(/\//, '\\/')
- end
-end
-
diff --git a/lib/puppet/parser/functions/substitute.rb b/lib/puppet/parser/functions/substitute.rb
deleted file mode 100644
index 4c97def3..00000000
--- a/lib/puppet/parser/functions/substitute.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# subsititute($string, $regex, $replacement) : $string
-# subsititute($string[], $regex, $replacement) : $string[]
-#
-# Replace all ocurrences of $regex in $string by $replacement.
-# $regex is interpreted as Ruby regular expression.
-#
-# For long-term portability it is recommended to refrain from using Ruby's
-# extended RE features.
-module Puppet::Parser::Functions
- newfunction(:substitute, :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/tfile.rb b/lib/puppet/parser/functions/tfile.rb
deleted file mode 100644
index acb6609b..00000000
--- a/lib/puppet/parser/functions/tfile.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-Puppet::Parser::Functions::newfunction(
- :tfile,
- :type => :rvalue,
- :doc => "Returns the content of a file. If the file or the path does not
- yet exist, it will create the path and touch the file."
-) do |args|
- raise Puppet::ParseError, 'tfile() needs one argument' if args.length != 1
- path = args.to_a.first
- unless File.exists?(path)
- dir = File.dirname(path)
- unless File.directory?(dir)
- require 'fileutils'
- FileUtils.mkdir_p(dir, :mode => 0700)
- end
- require 'fileutils'
- FileUtils.touch(path)
- end
- File.read(path)
-end