Fuel plugin which allows to use LDAP as an authentication backend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

parse_it.rb 691B

12345678910111213141516171819202122232425
  1. module Puppet::Parser::Functions
  2. newfunction(:parse_it, :type => :rvalue, :doc => <<-EOS
  3. This function parses text area, create hash and returns values
  4. for keystone domain creation
  5. EOS
  6. ) do |args|
  7. param_hash = {}
  8. cert_chain = args[0].slice!(/^(ca_chain=-----BEGIN CERTIFICATE-----)(.*[\r\n])+(-----END CERTIFICATE-----[\s\S]*?)$/)
  9. if cert_chain
  10. splited_cert_chain = cert_chain.split('=',2)
  11. param_hash[splited_cert_chain[0]] = splited_cert_chain[1]
  12. end
  13. splited_text = args[0].split("\n")
  14. splited_text.each do |item|
  15. splited_line = item.split('=',2)
  16. param_hash[splited_line[0]] = splited_line[1]
  17. end
  18. return param_hash
  19. end
  20. end