Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix win_reg_stat for HKU hives #59359

Merged
merged 1 commit into from Jul 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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