Method: Specinfra::Command::Windows::Base::Host.check_is_resolvable

Defined in:
lib/specinfra/command/windows/base/host.rb

.check_is_resolvable(name, type) ⇒ Object


3
4
5
6
7
8
9
10
# File 'lib/specinfra/command/windows/base/host.rb', line 3

def check_is_resolvable(name, type)
  if type == "hosts"
    cmd = "@(Select-String -path (Join-Path -Path $($env:windir) -ChildPath 'system32/drivers/etc/hosts') -pattern '#{name}\\b').count -gt 0"
  else
    cmd = "@([System.Net.Dns]::GetHostAddresses('#{name}')).count -gt 0"
  end
  Backend::PowerShell::Command.new { exec cmd }
end