summaryrefslogtreecommitdiff
path: root/lib/puppet
diff options
context:
space:
mode:
authorKen Barber <ken@bob.sh>2011-06-29 23:37:37 +0100
committerKen Barber <ken@bob.sh>2011-06-29 23:37:37 +0100
commit464fb1f41b9c7197fcaade6831b80d6390829ec7 (patch)
tree0849a4c8988fca9a090d1791cf77941fe5916fdd /lib/puppet
parentff56d9917e52b1a0d14478af74411e81e3633e4f (diff)
downloadpuppet-stdlib-464fb1f41b9c7197fcaade6831b80d6390829ec7.tar.gz
puppet-stdlib-464fb1f41b9c7197fcaade6831b80d6390829ec7.tar.bz2
Add some more functional tests.
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/functions/date.rb2
-rw-r--r--lib/puppet/parser/functions/delete.rb6
-rw-r--r--lib/puppet/parser/functions/fact.rb36
-rw-r--r--lib/puppet/parser/functions/grep.rb5
4 files changed, 13 insertions, 36 deletions
diff --git a/lib/puppet/parser/functions/date.rb b/lib/puppet/parser/functions/date.rb
index 4d0543e..bc62e60 100644
--- a/lib/puppet/parser/functions/date.rb
+++ b/lib/puppet/parser/functions/date.rb
@@ -12,6 +12,8 @@ module Puppet::Parser::Functions
"given #{arguments.size} for 1")
end
+ # TODO: stubbed
+
end
end
diff --git a/lib/puppet/parser/functions/delete.rb b/lib/puppet/parser/functions/delete.rb
index 88f3448..0d208b5 100644
--- a/lib/puppet/parser/functions/delete.rb
+++ b/lib/puppet/parser/functions/delete.rb
@@ -15,6 +15,12 @@ module Puppet::Parser::Functions
"given #{arguments.size} for 2")
end
+ a = arguments[0]
+ item = arguments[1]
+
+ a.delete(item)
+ a
+
end
end
diff --git a/lib/puppet/parser/functions/fact.rb b/lib/puppet/parser/functions/fact.rb
deleted file mode 100644
index 27b7bb2..0000000
--- a/lib/puppet/parser/functions/fact.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# fact.rb
-#
-
-module Puppet::Parser::Functions
- newfunction(:fact, :type => :rvalue, :doc => <<-EOS
- EOS
- ) do |arguments|
-
- raise(Puppet::ParseError, "fact(): Wrong number of arguments " +
- "given (#{arguments.size} for 1)") if arguments.size < 1
-
- fact = arguments[0]
-
- unless fact.is_a?(String)
- raise(Puppet::ParseError, 'fact(): Requires fact name to be a string')
- end
-
- raise(Puppet::ParseError, 'fact(): You must provide ' +
- 'fact name') if fact.empty?
-
- result = lookupvar(fact) # Get the value of interest from Facter ...
-
- #
- # Now this is a funny one ... Puppet does not have a concept of
- # returning neither undef nor nil back for use within the Puppet DSL
- # and empty string is as closest to actual undef as you we can get
- # at this point in time ...
- #
- result = result.empty? ? '' : result
-
- return result
- end
-end
-
-# vim: set ts=2 sw=2 et :
diff --git a/lib/puppet/parser/functions/grep.rb b/lib/puppet/parser/functions/grep.rb
index 8549218..2caaa6f 100644
--- a/lib/puppet/parser/functions/grep.rb
+++ b/lib/puppet/parser/functions/grep.rb
@@ -12,6 +12,11 @@ module Puppet::Parser::Functions
"given #{arguments.size} for 2")
end
+ a = arguments[0]
+ pattern = Regexp.new(arguments[1])
+
+ a.grep(pattern)
+
end
end