Puppet Function: convert_cert_to_string
  
    - Defined in:
 
    - 
      lib/puppet/functions/convert_cert_to_string.rb
    
 
  
  
    - Function type:
 
    - Ruby 4.x API
 
  
 
Overview
  
  
    
      
        convert_cert_to_string(String $cert_file) ⇒ Any 
      
    
  
  
  
  
  
    
      
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 
       | 
      
        # File 'lib/puppet/functions/convert_cert_to_string.rb', line 1
Puppet::Functions.create_function(:convert_cert_to_string) do
  dispatch :convert_cert_to_string do
    param 'String', :cert_file
  end
  def convert_cert_to_string(cert_file)
    unless File.file?(cert_file)
      raise Puppet::ParseError, "Certificate file not found: #{cert_file}"
    end
    text=File.readlines(cert_file)
    cert_string = ''
    text.each do |line|
      unless line.include? '-----'
        cert_string += line.strip
      end
    end
    return cert_string
  end
end
       |