Method: Pec::Handler::Keypair.build

Defined in:
lib/pec/handler/keypair.rb

.build(config) ⇒ Object



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

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

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