mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
windows testing - changes to accomodate future behaviour changes (#45464)
This commit is contained in:
parent
0b029d6792
commit
881f3a599c
5 changed files with 24 additions and 17 deletions
|
@ -309,6 +309,13 @@ if($gather_subset.Contains('platform')) {
|
||||||
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
|
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
|
||||||
$ip_props = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()
|
$ip_props = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()
|
||||||
|
|
||||||
|
try {
|
||||||
|
$ansible_reboot_pending = Get-PendingRebootStatus
|
||||||
|
} catch {
|
||||||
|
# fails for non-admin users, set to null in this case
|
||||||
|
$ansible_reboot_pending = $null
|
||||||
|
}
|
||||||
|
|
||||||
$ansible_facts += @{
|
$ansible_facts += @{
|
||||||
ansible_architecture = $win32_os.OSArchitecture
|
ansible_architecture = $win32_os.OSArchitecture
|
||||||
ansible_domain = $ip_props.DomainName
|
ansible_domain = $ip_props.DomainName
|
||||||
|
@ -320,7 +327,7 @@ if($gather_subset.Contains('platform')) {
|
||||||
ansible_owner_contact = ([string] $win32_cs.PrimaryOwnerContact)
|
ansible_owner_contact = ([string] $win32_cs.PrimaryOwnerContact)
|
||||||
ansible_owner_name = ([string] $win32_cs.PrimaryOwnerName)
|
ansible_owner_name = ([string] $win32_cs.PrimaryOwnerName)
|
||||||
# FUTURE: should this live in its own subset?
|
# FUTURE: should this live in its own subset?
|
||||||
ansible_reboot_pending = (Get-PendingRebootStatus)
|
ansible_reboot_pending = $ansible_reboot_pending
|
||||||
ansible_system = $osversion.Platform.ToString()
|
ansible_system = $osversion.Platform.ToString()
|
||||||
ansible_system_description = ([string] $win32_os.Description)
|
ansible_system_description = ([string] $win32_os.Description)
|
||||||
ansible_system_vendor = $win32_cs.Manufacturer
|
ansible_system_vendor = $win32_cs.Manufacturer
|
||||||
|
|
|
@ -365,6 +365,13 @@ ElseIf (-not $current_bindings -and $state -eq 'present')
|
||||||
$result.changed = $true
|
$result.changed = $true
|
||||||
$result.operation_type = 'added'
|
$result.operation_type = 'added'
|
||||||
$result.website_state = (Get-Website | Where-Object {$_.Name -eq $Name}).State
|
$result.website_state = (Get-Website | Where-Object {$_.Name -eq $Name}).State
|
||||||
$result.binding_info = Create-BindingInfo (Get-SingleWebBinding $binding_parameters)
|
|
||||||
|
# incase there are no bindings we do a check before calling Create-BindingInfo
|
||||||
|
$web_binding = Get-SingleWebBinding $binding_parameters
|
||||||
|
if ($web_binding) {
|
||||||
|
$result.binding_info = Create-BindingInfo $web_binding
|
||||||
|
} else {
|
||||||
|
$result.binding_info = $null
|
||||||
|
}
|
||||||
Exit-Json $result
|
Exit-Json $result
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,13 @@ If ($info -ne $null) {
|
||||||
# checksum = a file and get_checksum: True
|
# checksum = a file and get_checksum: True
|
||||||
# md5 = a file and get_md5: True
|
# md5 = a file and get_md5: True
|
||||||
}
|
}
|
||||||
$stat.owner = $info.GetAccessControl().Owner
|
try {
|
||||||
|
$stat.owner = $info.GetAccessControl().Owner
|
||||||
|
} catch {
|
||||||
|
# may not have rights, historical behaviour was to just set to $null
|
||||||
|
# due to ErrorActionPreference being set to "Continue"
|
||||||
|
$stat.owner = $null
|
||||||
|
}
|
||||||
|
|
||||||
# values that are set according to the type of file
|
# values that are set according to the type of file
|
||||||
if ($info.Attributes.HasFlag([System.IO.FileAttributes]::Directory)) {
|
if ($info.Attributes.HasFlag([System.IO.FileAttributes]::Directory)) {
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
$os = [Environment]::OSVersion
|
|
||||||
$major = $os.Version.Major
|
|
||||||
$minor = $os.Version.Minor
|
|
||||||
$ok = $false
|
|
||||||
|
|
||||||
if(($major -gt 6)){
|
|
||||||
$ok = $true
|
|
||||||
}
|
|
||||||
elseif (($major -eq 6) -and ($minor -ge 3)){
|
|
||||||
$ok = $true
|
|
||||||
}
|
|
||||||
|
|
||||||
$ok
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
|
|
||||||
- name: get os info
|
- name: get os info
|
||||||
script: ../files/Test-Os.ps1
|
win_shell: '[Environment]::OSVersion.Version -ge [Version]"6.3"'
|
||||||
register: os
|
register: os
|
||||||
|
|
||||||
- name: Perform with os Windows 2012R2 or newer
|
- name: Perform with os Windows 2012R2 or newer
|
||||||
|
|
Loading…
Reference in a new issue