Class: Ant::SSL::Inventory

Inherits:
Object
  • Object
show all
Defined in:
lib/ant/ssl/inventory.rb

Overview

This provides a full inventory of PKI. It is composed of:

  • Authorities

  • Clients

  • Servers

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(defaults, auth, clients, servers) ⇒ Inventory

Returns a new instance of Inventory.



19
20
21
22
23
24
# File 'lib/ant/ssl/inventory.rb', line 19

def initialize(defaults, auth, clients, servers)
  @defaults = defaults
  @authorities = SubInventory.new(auth, self)
  @clients = SubInventory.new(clients, self)
  @servers = SubInventory.new(servers, self)
end

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



17
18
19
# File 'lib/ant/ssl/inventory.rb', line 17

def defaults
  @defaults
end

Instance Method Details

#ca(name) ⇒ Object



41
42
43
# File 'lib/ant/ssl/inventory.rb', line 41

def ca(name)
  @authorities.ca(name)
end

#create_certificates!Object



26
27
28
29
30
# File 'lib/ant/ssl/inventory.rb', line 26

def create_certificates!
  validate_inventories!
  create_directory!
  [@authorities, @clients, @servers].each(&:create_certificates!)
end

#create_directory!Object



37
38
39
# File 'lib/ant/ssl/inventory.rb', line 37

def create_directory!
  FileUtils.mkdir_p(@defaults['saving_directory'])
end

#validate_inventories!Object

TODO: Implement validation of inventories



33
34
35
# File 'lib/ant/ssl/inventory.rb', line 33

def validate_inventories!
  true
end