Class: VagrantPlugins::ProviderZone::QGA::WindowsBackend
- Inherits:
-
BaseBackend
- Object
- BaseBackend
- VagrantPlugins::ProviderZone::QGA::WindowsBackend
- Defined in:
- lib/vagrant-zones/qga/windows_backend.rb
Overview
Renames the matched adapter and assigns IP/DNS via netsh per NIC.
Constant Summary collapse
- NETSH =
'netsh.exe'
Instance Method Summary collapse
Methods inherited from BaseBackend
Instance Method Details
#apply(uii, qga, nics, _ctx) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/vagrant-zones/qga/windows_backend.rb', line 17 def apply(uii, qga, nics, _ctx) nics.each do |entry| adapter = find_adapter_name(qga, entry[:mac]) raise Errors::QGAError, message: "Windows adapter for MAC #{entry[:mac]} not found" if adapter.nil? || adapter.empty? rename(qga, adapter, entry[:vnic_name]) unless adapter == entry[:vnic_name] configure_ipv4(qga, entry) configure_dns(qga, entry) if entry[:dns] && !entry[:dns].empty? uii.info(I18n.t('vagrant_zones.qga_backend_apply') + " windows-netsh #{entry[:vnic_name]}") end end |
#detect?(qga) ⇒ Boolean
10 11 12 13 14 15 |
# File 'lib/vagrant-zones/qga/windows_backend.rb', line 10 def detect?(qga) os = qga.osinfo os['id'].to_s.downcase == 'mswindows' || os['kernel-version'].to_s.include?('Windows') rescue StandardError false end |