Module: Puppet::Parser::Functions
- Defined in:
- lib/puppet/parser/functions/icinga2_attributes.rb,
lib/puppet/parser/functions/icinga2_ticket_id.rb
Instance Method Summary collapse
-
#icinga2_attributes ⇒ Object
Parsed config as string.
-
#icinga2_ticket_id ⇒ Object
The ticket to get a certificate.
Instance Method Details
#icinga2_attributes ⇒ Object
Returns Parsed config as string.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/puppet/parser/functions/icinga2_attributes.rb', line 10 newfunction(:icinga2_attributes, :type => :rvalue) do |args| raise Puppet::ParseError, 'icinga2_atributes(): Must provide at least one argument.' if args.length > 4 || args.length < 1 if args[1] indent = args[1] else indent = 0 end if args[2] globals = args[2].concat(lookupvar('::icinga2::_reserved')) else globals = lookupvar('::icinga2::_reserved') end if args[3] constants = args[3].merge(lookupvar('::icinga2::_constants')) else constants = lookupvar('::icinga2::_constants') end Puppet::Icinga2::Utils.attributes(args[0], globals, constants, indent) end |
#icinga2_ticket_id ⇒ Object
Returns The ticket to get a certificate.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/puppet/parser/functions/icinga2_ticket_id.rb', line 8 newfunction(:icinga2_ticket_id, :type => :rvalue) do |args| raise Puppet::ParseError, 'Must provide exactly two arguments to icinga2_ticket_id' if args.length != 2 if !args[0] or args[0] == '' raise Puppet::ParseError, 'first argument (cn) can not be empty for icinga2_ticket_id' end if !args[1] or args[1] == '' raise Puppet::ParseError, 'second argument (salt) can not be empty for icinga2_ticket_id' end PBKDF2.new( :password => args[0], :salt => args[1], :iterations => 50000, :hash_function => OpenSSL::Digest.new("sha1") ).hex_string end |