Class: Pec::Handler::Keypair

Inherits:
Base
  • Object
show all
Defined in:
lib/pec/handler/keypair.rb

Class Method Summary collapse

Class Method Details

.build(host) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/pec/handler/keypair.rb', line 5

def self.build(host)
  return({}) unless host.keypair

  Pec::Logger.notice "keypair is #{host.keypair}"
  keypair = Yao::Keypair.list.find {|k| k.name == host.keypair }
  if keypair
    {
      key_name: keypair.name,
    }
  else
    raise Pec::ConfigError, "keypair name=#{host.keypair} does not exist"
  end
end