Class: Kybus::SSL::SubInventory
- Inherits:
-
Object
- Object
- Kybus::SSL::SubInventory
- Defined in:
- lib/kybus/ssl/inventory.rb
Overview
Implements a single inventory. It creates certificates using similar configurations.
Instance Method Summary collapse
- #ca(name) ⇒ Object
- #ca_cert_chain(name) ⇒ Object
- #create_certificates! ⇒ Object
-
#initialize(configs, inventory) ⇒ SubInventory
constructor
A new instance of SubInventory.
- #update_crl ⇒ Object
Constructor Details
#initialize(configs, inventory) ⇒ SubInventory
Returns a new instance of SubInventory.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/kybus/ssl/inventory.rb', line 64 def initialize(configs, inventory) raise 'Nil config' if configs.nil? defaults = configs['defaults'] @parent = inventory @certificates = configs['certificates'].map do |cert| configuration = Configuration.new( inventory.defaults, defaults, cert ) Certificate.new(configuration, inventory) end end |
Instance Method Details
#ca(name) ⇒ Object
98 99 100 101 102 103 |
# File 'lib/kybus/ssl/inventory.rb', line 98 def ca(name) ca = @certificates.find { |cert| cert.ca_name == name } raise "CA #{name} not found" if ca.nil? ca end |
#ca_cert_chain(name) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/kybus/ssl/inventory.rb', line 79 def ca_cert_chain(name) chain = [] cert = ca(name) while cert && cert.ca_name != 'root' puts cert.ca_name chain << cert.cert cert = @certificates.find { |c| c.ca_name == cert.config['parent'] } end chain end |
#create_certificates! ⇒ Object
94 95 96 |
# File 'lib/kybus/ssl/inventory.rb', line 94 def create_certificates! @certificates.each(&:create!) end |
#update_crl ⇒ Object
91 92 |
# File 'lib/kybus/ssl/inventory.rb', line 91 def update_crl end |