Class: VagrantPlugins::Deltacloud::Action::ReadSSHInfo
- Inherits:
-
AbstractAction
- Object
- AbstractAction
- VagrantPlugins::Deltacloud::Action::ReadSSHInfo
- Includes:
- Command::Utils
- Defined in:
- lib/vagrant-deltacloud-provider/action/read_ssh_info.rb
Overview
This action reads the SSH info for the machine and puts it into the ‘:machine_ssh_info` key in the environment.
Instance Method Summary collapse
- #execute(env) ⇒ Object
-
#initialize(app, _env, resolver = ConfigResolver.new) ⇒ ReadSSHInfo
constructor
A new instance of ReadSSHInfo.
Methods included from Command::Utils
#display_item_list, #display_table, #get_ip_address
Methods inherited from AbstractAction
Constructor Details
#initialize(app, _env, resolver = ConfigResolver.new) ⇒ ReadSSHInfo
Returns a new instance of ReadSSHInfo.
16 17 18 19 20 |
# File 'lib/vagrant-deltacloud-provider/action/read_ssh_info.rb', line 16 def initialize(app, _env, resolver = ConfigResolver.new) @app = app @logger = Log4r::Logger.new('vagrant_deltacloud::action::read_ssh_info') @resolver = resolver end |
Instance Method Details
#execute(env) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-deltacloud-provider/action/read_ssh_info.rb', line 22 def execute(env) @logger.info 'Reading SSH info' env[:deltacloud_client] = Deltacloud::DeltacloudClient.instance server_id = env[:machine].id.to_sym SSHInfoHolder.instance.tap do |holder| holder.synchronize do holder.ssh_info[server_id] = read_ssh_info(env) if holder.ssh_info[server_id].nil? env[:machine_ssh_info] = holder.ssh_info[server_id] end end @app.call(env) end |