Class: Mccloud::Config::Keypair

Inherits:
Object
  • Object
show all
Defined in:
lib/mccloud/config/keypair.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Keypair

Returns a new instance of Keypair.



12
13
14
15
16
# File 'lib/mccloud/config/keypair.rb', line 12

def initialize(config)
  @env=config.env
  @components=Hash.new
  env.logger.debug("initalizing keypair")
end

Instance Attribute Details

#componentsObject

Returns the value of attribute components.



9
10
11
# File 'lib/mccloud/config/keypair.rb', line 9

def components
  @components
end

#envObject (readonly)

Returns the value of attribute env.



10
11
12
# File 'lib/mccloud/config/keypair.rb', line 10

def env
  @env
end

Instance Method Details

#define(name) {|keypair_stub| ... } ⇒ Object

Yields:

  • (keypair_stub)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/mccloud/config/keypair.rb', line 18

def define(name)
  # We do this for vagrant syntax
  # Depending on type, we create a variable of that type
  # f.i. component_stub.vm or component_stub.lb
  keypair_stub=OpenStruct.new
  keypair_stub.keypair=::Mccloud::Keypair.new(name,env)

  env.logger.debug("config keypair"){ "Start reading keypair"}

  yield keypair_stub

  env.logger.debug("config keypair"){ "End reading keypair #{keypair_stub.keypair.name}"}

  components[name.to_s]=keypair_stub.keypair
end