1
0
Fork 0
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:
Jordan Borean 2018-09-11 13:04:23 +10:00 committed by GitHub
parent 0b029d6792
commit 881f3a599c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 17 deletions

View file

@ -309,6 +309,13 @@ if($gather_subset.Contains('platform')) {
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$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_architecture = $win32_os.OSArchitecture
ansible_domain = $ip_props.DomainName
@ -320,7 +327,7 @@ if($gather_subset.Contains('platform')) {
ansible_owner_contact = ([string] $win32_cs.PrimaryOwnerContact)
ansible_owner_name = ([string] $win32_cs.PrimaryOwnerName)
# 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_description = ([string] $win32_os.Description)
ansible_system_vendor = $win32_cs.Manufacturer

View file

@ -365,6 +365,13 @@ ElseIf (-not $current_bindings -and $state -eq 'present')
$result.changed = $true
$result.operation_type = 'added'
$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
}

View file

@ -70,7 +70,13 @@ If ($info -ne $null) {
# checksum = a file and get_checksum: 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
if ($info.Attributes.HasFlag([System.IO.FileAttributes]::Directory)) {

View file

@ -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

View file

@ -19,7 +19,7 @@
- name: get os info
script: ../files/Test-Os.ps1
win_shell: '[Environment]::OSVersion.Version -ge [Version]"6.3"'
register: os
- name: Perform with os Windows 2012R2 or newer