Sha256: be2582ba0aa088d5ae58edc6bbc7a850be06bda0cbe6b49d6682064d69e35940

Contents?: true

Size: 808 Bytes

Versions: 48

Compression:

Stored size: 808 Bytes

Contents

#
# ensure.rb
#
# Checks a given test and returns the success value or a failure value based on test results.
#
module Puppet::Parser::Functions
  newfunction(:ensure, :type => :rvalue, :doc => <<-EOS
This function checks a given test and returns the success value or a failure value based on test results.
    EOS
) do |args|
    
    value = nil
    CORL.run do
      raise(Puppet::ParseError, "ensure(): Must have at least a test and optional success and failure values specified; " +
        "given (#{args.size} for 1)") if args.size < 1
      
      test          = args[0]
      success_value = (args.size > 1 ? args[1] : test)
      failure_value = (args.size > 2 ? args[2] : :undef)
      
      value = CORL::Util::Data.ensure(test, success_value, failure_value)
    end
    return value
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
corl-0.4.8 lib/puppet/parser/functions/ensure.rb
corl-0.4.7 lib/puppet/parser/functions/ensure.rb
corl-0.4.6 lib/puppet/parser/functions/ensure.rb
corl-0.4.5 lib/puppet/parser/functions/ensure.rb
corl-0.4.4 lib/puppet/parser/functions/ensure.rb
corl-0.4.3 lib/puppet/parser/functions/ensure.rb
corl-0.4.2 lib/puppet/parser/functions/ensure.rb
corl-0.4.1 lib/puppet/parser/functions/ensure.rb