Fixed per review

This commit is contained in:
ShachafGoldstein 2019-05-28 20:17:00 +03:00
parent 44683daa62
commit f91cbf78e0
2 changed files with 10 additions and 5 deletions

View file

@ -1,2 +1,2 @@
bugfixes:
- "setup.ps1 - Change $env:COMPUTERNAME to [System.Net.Dns]::GetHostName(), to support non NETBIOS compliant hostnames (https://github.com/ansible/ansible/issues/54550)"
- "setup.ps1 - Support non NETBIOS compliant hostnames (https://github.com/ansible/ansible/issues/54550)"

View file

@ -307,7 +307,12 @@ if($gather_subset.Contains('memory')) {
if($gather_subset.Contains('platform')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
#$ip_props = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()
$domainSuffix = $win32_cs.Domain.Substring($win32_cs.Workgroup.length)
if ($domainSuffix -ne "")
{s
$domainSuffix = ".$domainSuffix"
}
try {
$ansible_reboot_pending = Get-PendingRebootStatus
@ -318,12 +323,12 @@ if($gather_subset.Contains('platform')) {
$ansible_facts += @{
ansible_architecture = $win32_os.OSArchitecture
ansible_domain = $win32_cs.Domain.Substring($win32_cs.Workgroup.length)
ansible_fqdn = ($win32_cs.DNSHostname + "." + $win32_cs.Domain.Substring($win32_cs.Workgroup.length))
ansible_domain = $domainSuffix
ansible_fqdn = ($win32_cs.DNSHostname + "." + $domainSuffix)
ansible_hostname = $win32_cs.DNSHostname
ansible_netbios_name = $win32_cs.Name
ansible_kernel = $osversion.Version.ToString()
ansible_nodename = ($win32_cs.DNSHostname + "." + $win32_cs.Domain.Substring($win32_cs.Workgroup.length))
ansible_nodename = ($win32_cs.DNSHostname + "." + $domainSuffix)
ansible_machine_id = Get-MachineSid
ansible_owner_contact = ([string] $win32_cs.PrimaryOwnerContact)
ansible_owner_name = ([string] $win32_cs.PrimaryOwnerName)