Fix win_reg_stat for HKU hives (#59359)

(cherry picked from commit 2f2b106423)
This commit is contained in:
Jordan Borean 2019-07-22 09:12:14 +10:00 committed by Toshio Kuratomi
parent ffa92f7725
commit e5f68cad5a
3 changed files with 16 additions and 1 deletions

View file

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

View file

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

View file

@ -362,3 +362,16 @@
assert:
that:
- 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