Fix win_reg_stat for HKU hives (#59359)

pull/59362/head
Jordan Borean 5 years ago committed by GitHub
parent 74598b212e
commit 2f2b106423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- win_reg_stat - fix issue when trying to check keys in ``HKU:\`` - https://github.com/ansible/ansible/issues/59337

@ -80,7 +80,7 @@ $registry_hive = switch(Split-Path -Path $path -Qualifier) {
"HKCC:" { [Microsoft.Win32.Registry]::CurrentConfig } "HKCC:" { [Microsoft.Win32.Registry]::CurrentConfig }
"HKCU:" { [Microsoft.Win32.Registry]::CurrentUser } "HKCU:" { [Microsoft.Win32.Registry]::CurrentUser }
"HKLM:" { [Microsoft.Win32.Registry]::LocalMachine } "HKLM:" { [Microsoft.Win32.Registry]::LocalMachine }
"HKU" { [Microsoft.Win32.Registry]::Users } "HKU:" { [Microsoft.Win32.Registry]::Users }
} }
$key = $null $key = $null

@ -362,3 +362,16 @@
assert: assert:
that: that:
- not actual.exists - not actual.exists
# Tests https://github.com/ansible/ansible/issues/59337
- name: test out all registry hives
win_reg_stat:
path: '{{ item }}'
register: reg_hive_stat
failed_when: not reg_hive_stat.exists
with_items:
- HKCR:\*
- HKCC:\Software
- HKCU:\Software
- HKLM:\Software
- HKU:\.DEFAULT

Loading…
Cancel
Save