Please review pull request #22: Added hiera_configured function to test that hiera is functioning from within a manifest opened by (eshamow)

Description:

  • Opened: Fri Apr 06 23:37:36 UTC 2012
  • Based on: puppetlabs:master (54be04bb999004d34f19a0482299d017556604af)
  • Requested merge: eshamow:tickets/feature/13676_add_hiera_configured_function (273c7e63a47dc71a77da7a8f108e5c8b0e495d0e)

Diff follows:

diff --git a/lib/puppet/parser/functions/hiera_configured.rb b/lib/puppet/parser/functions/hiera_configured.rb
new file mode 100644
index 0000000..46060f9
--- /dev/null
+++ b/lib/puppet/parser/functions/hiera_configured.rb
@@ -0,0 +1,29 @@
+#
+# hiera_configured.rb
+#
+
+module Puppet::Parser::Functions
+  newfunction(:hiera_configured, :type => :rvalue, :doc => <<-EOS
+This function attempts to run the :hiera function against the argument you
+provide to determine if it is fully configured.  Returns a boolean.
+    EOS
+  ) do |arguments|
+
+    if (arguments.size != 1) then
+      raise(Puppet::ParseError, "hiera_configured(): Wrong number of arguments "+
+        "given #{arguments.size} for 1")
+    end
+
+    begin
+      if function_hiera([arguments[0].to_sym])
+        return true
+      else
+        return false
+      end 
+    rescue
+      false
+    end
+  end
+end
+
+# vim: set ts=2 sw=2 et :

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to