Skip to content

Commit

Permalink
Fix win_reg_stat for HKU hives (ansible#59359)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2f2b106)
  • Loading branch information
jborean93 committed Jul 21, 2019
1 parent 8074fa9 commit e3a9fe6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/win_reg_stat-hku.yaml
@@ -0,0 +1,2 @@
bugfixes:
- win_reg_stat - fix issue when trying to check keys in ``HKU:\`` - https://github.com/ansible/ansible/issues/59337
2 changes: 1 addition & 1 deletion lib/ansible/modules/windows/win_reg_stat.ps1
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions test/integration/targets/win_reg_stat/tasks/tests.yml
Expand Up @@ -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

0 comments on commit e3a9fe6

Please sign in to comment.