Sha256: 0a1cf15fdc56fc65a8e890e5bfb7c8ad46d3ca3148588be8940cf667fbc8f9a5
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
module VagrantPlugins module VCenter module Action # This class reads the IP info for the VM that the Vagrant provider is # managing using VMware Tools. class ReadSSHInfo # FIXME: More work needed here for vCenter logic (vApp, VM IPs, etc.) def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant_vcenter::action::read_ssh_info') end def call(env) env[:machine_ssh_info] = read_ssh_info(env) @app.call env end def read_ssh_info(env) return nil if env[:machine].id.nil? config = env[:machine].provider_config # FIXME: Raise a correct exception dc = config.vcenter_cnx.serviceInstance.find_datacenter( config.datacenter_name) or abort 'datacenter not found' root_vm_folder = dc.vmFolder vm = root_vm_folder.findByUuid(env[:machine].id) @logger.debug("IP Address: #{vm.guest.ipAddress}") { :host => vm.guest.ipAddress, :port => 22 } end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems