Class: VagrantPlugins::Openstack::Action::ReadSSHInfo
- Inherits:
-
AbstractAction
- Object
- AbstractAction
- VagrantPlugins::Openstack::Action::ReadSSHInfo
- Defined in:
- lib/vagrant-openstack-illuin-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, utils = Utils.new) ⇒ ReadSSHInfo
constructor
A new instance of ReadSSHInfo.
Methods inherited from AbstractAction
Constructor Details
#initialize(app, _env, resolver = ConfigResolver.new, utils = Utils.new) ⇒ ReadSSHInfo
Returns a new instance of ReadSSHInfo.
14 15 16 17 18 19 |
# File 'lib/vagrant-openstack-illuin-provider/action/read_ssh_info.rb', line 14 def initialize(app, _env, resolver = ConfigResolver.new, utils = Utils.new) @app = app @logger = Log4r::Logger.new('vagrant_openstack::action::read_ssh_info') @resolver = resolver @utils = utils end |
Instance Method Details
#execute(env) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vagrant-openstack-illuin-provider/action/read_ssh_info.rb', line 21 def execute(env) @logger.info 'Reading SSH info' 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 |