Class: VagrantPlugins::Openstack::Action::ReadSSHInfo
- Inherits:
-
Object
- Object
- VagrantPlugins::Openstack::Action::ReadSSHInfo
- Defined in:
- lib/vagrant-openstack-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
- #call(env) ⇒ Object
-
#initialize(app, _env, resolver = ConfigResolver.new, utils = Utils.new) ⇒ ReadSSHInfo
constructor
A new instance of ReadSSHInfo.
Constructor Details
#initialize(app, _env, resolver = ConfigResolver.new, utils = Utils.new) ⇒ ReadSSHInfo
Returns a new instance of ReadSSHInfo.
12 13 14 15 16 17 |
# File 'lib/vagrant-openstack-provider/action/read_ssh_info.rb', line 12 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
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant-openstack-provider/action/read_ssh_info.rb', line 19 def call(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 |