Class: Puppet::SSL::CertificateRequestAttributes Private
- Defined in:
- lib/puppet/ssl/certificate_request_attributes.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
This class transforms simple key/value pairs into the equivalent ASN1 structures. Values may be strings or arrays of strings.
Instance Attribute Summary collapse
- #custom_attributes ⇒ Object readonly private
- #extension_requests ⇒ Object readonly private
- #path ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(path) ⇒ CertificateRequestAttributes
constructor
private
A new instance of CertificateRequestAttributes.
-
#load ⇒ Object
private
Attempt to load a yaml file at the given @path.
Constructor Details
#initialize(path) ⇒ CertificateRequestAttributes
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CertificateRequestAttributes.
12 13 14 15 16 |
# File 'lib/puppet/ssl/certificate_request_attributes.rb', line 12 def initialize(path) @path = path @custom_attributes = {} @extension_requests = {} end |
Instance Attribute Details
#custom_attributes ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/puppet/ssl/certificate_request_attributes.rb', line 10 def custom_attributes @custom_attributes end |
#extension_requests ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/puppet/ssl/certificate_request_attributes.rb', line 10 def extension_requests @extension_requests end |
#path ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/puppet/ssl/certificate_request_attributes.rb', line 10 def path @path end |
Instance Method Details
#load ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Attempt to load a yaml file at the given @path.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/puppet/ssl/certificate_request_attributes.rb', line 21 def load Puppet.info(_("csr_attributes file loading from %{path}") % { path: path }) if Puppet::FileSystem.exist?(path) hash = Puppet::Util::Yaml.load_file(path, {}) if ! hash.is_a?(Hash) raise Puppet::Error, _("invalid CSR attributes, expected instance of Hash, received instance of %{klass}") % { klass: hash.class } end @custom_attributes = hash.delete('custom_attributes') || {} @extension_requests = hash.delete('extension_requests') || {} if not hash.keys.empty? raise Puppet::Error, _("unexpected attributes %{keys} in %{path}") % { keys: hash.keys.inspect, path: @path.inspect } end return true end return false end |