Class: VagrantPlugins::SimpleCloud::Actions::SetupKey
- Inherits:
-
Object
- Object
- VagrantPlugins::SimpleCloud::Actions::SetupKey
- Includes:
- Helpers::Client
- Defined in:
- lib/vagrant-simplecloud/actions/setup_key.rb
Instance Method Summary collapse
-
#call(env) ⇒ Object
TODO check the content of the key to see if it has changed.
-
#initialize(app, env) ⇒ SetupKey
constructor
A new instance of SetupKey.
Methods included from Helpers::Client
Constructor Details
#initialize(app, env) ⇒ SetupKey
Returns a new instance of SetupKey.
9 10 11 12 13 14 15 |
# File 'lib/vagrant-simplecloud/actions/setup_key.rb', line 9 def initialize(app, env) @app = app @machine = env[:machine] @client = client @simple_client = simple_client @logger = Log4r::Logger.new('vagrant::simplecloud::setup_key') end |
Instance Method Details
#call(env) ⇒ Object
TODO check the content of the key to see if it has changed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-simplecloud/actions/setup_key.rb', line 18 def call(env) ssh_key_name = @machine.provider_config.ssh_key_name # assigns existing ssh key id to env for use by other commands @simple_client.ssh_keys.all().each do |key| if key["name"] == ssh_key_name env[:ssh_key_id] = key["id"] env[:ui].info I18n.t('vagrant_simple_cloud.info.using_key', { :name => ssh_key_name }) @app.call(env) return end end env[:ssh_key_id] = create_ssh_key(ssh_key_name, env) @app.call(env) end |