Class: VagrantPlugins::Lightsail::Action::SetupKey
- Inherits:
-
Object
- Object
- VagrantPlugins::Lightsail::Action::SetupKey
- Defined in:
- lib/vagrant-lightsail/action/setup_key.rb
Overview
This sets up the configured SSH key
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, _) ⇒ SetupKey
constructor
A new instance of SetupKey.
Constructor Details
#initialize(app, _) ⇒ SetupKey
Returns a new instance of SetupKey.
8 9 10 11 |
# File 'lib/vagrant-lightsail/action/setup_key.rb', line 8 def initialize(app, _) @app = app @logger = Log4r::Logger.new('vagrant_lightsail::action::setup_key') end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vagrant-lightsail/action/setup_key.rb', line 13 def call(env) keypair_name = env[:machine].provider_config.keypair_name begin env[:lightsail_client].get_key_pair(key_pair_name: keypair_name) rescue Aws::Lightsail::Errors::NotFoundException create_ssh_key(keypair_name, env) end @app.call(env) end |