mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
Fix win_regedit module and tests. (#35478)
This commit is contained in:
@@ -469,13 +469,15 @@
|
||||
|
||||
- name: get result of create new key in loaded hive (check mode)
|
||||
win_shell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
®.exe load HKLM\ANSIBLE C:\Users\Default\NTUSER.dat > $null
|
||||
Test-Path -Path HKLM:\ANSIBLE\NewKey
|
||||
[GC]::Collect()
|
||||
[GC]::WaitForPendingFinalizers()
|
||||
®.exe unload HKLM\ANSIBLE > $null
|
||||
exit 0
|
||||
register: new_key_in_hive_result_check
|
||||
|
||||
- win_command: reg.exe unload HKLM\ANSIBLE
|
||||
|
||||
- name: assert result of create new key in loaded hive (check mode)
|
||||
assert:
|
||||
that:
|
||||
@@ -491,13 +493,15 @@
|
||||
|
||||
- name: get result of create new key in loaded hive
|
||||
win_shell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
®.exe load HKLM\ANSIBLE C:\Users\Default\NTUSER.dat > $null
|
||||
Test-Path -Path HKLM:\ANSIBLE\NewKey
|
||||
[GC]::Collect()
|
||||
[GC]::WaitForPendingFinalizers()
|
||||
®.exe unload HKLM\ANSIBLE > $null
|
||||
exit 0
|
||||
register: new_key_in_hive_result
|
||||
|
||||
- win_command: reg.exe unload HKLM\ANSIBLE
|
||||
|
||||
- name: assert result of create new key in loaded hive
|
||||
assert:
|
||||
that:
|
||||
@@ -533,12 +537,12 @@
|
||||
$prop = Get-ItemProperty -Path HKLM:\ANSIBLE\NewKey -Name TestProp -ErrorAction SilentlyContinue
|
||||
if ($prop) {
|
||||
$prop.TestProp
|
||||
$prop.Close()
|
||||
}
|
||||
®.exe unload HKLM\ANSIBLE > $null
|
||||
exit 0
|
||||
register: new_prop_in_hive_result_check
|
||||
|
||||
- win_command: reg.exe unload HKLM\ANSIBLE
|
||||
|
||||
- name: assert result of set hive key property (check mode)
|
||||
assert:
|
||||
that:
|
||||
@@ -561,12 +565,12 @@
|
||||
$prop = Get-ItemProperty -Path HKLM:\ANSIBLE\NewKey -Name TestProp -ErrorAction SilentlyContinue
|
||||
if ($prop) {
|
||||
$prop.TestProp
|
||||
$prop.Close()
|
||||
}
|
||||
®.exe unload HKLM\ANSIBLE > $null
|
||||
exit 0
|
||||
register: new_prop_in_hive_result
|
||||
|
||||
- win_command: reg.exe unload HKLM\ANSIBLE
|
||||
|
||||
- name: assert result of set hive key property
|
||||
assert:
|
||||
that:
|
||||
@@ -603,12 +607,12 @@
|
||||
$prop = Get-ItemProperty -Path HKLM:\ANSIBLE\NewKey -Name TestProp -ErrorAction SilentlyContinue
|
||||
if ($prop) {
|
||||
$prop.TestProp
|
||||
$prop.Close()
|
||||
}
|
||||
®.exe unload HKLM\ANSIBLE > $null
|
||||
exit 0
|
||||
register: remove_prop_in_hive_result_check
|
||||
|
||||
- win_command: reg.exe unload HKLM\ANSIBLE
|
||||
|
||||
- name: assert result of remove hive key property (check mode)
|
||||
assert:
|
||||
that:
|
||||
@@ -629,12 +633,12 @@
|
||||
$prop = Get-ItemProperty -Path HKLM:\ANSIBLE\NewKey -Name TestProp -ErrorAction SilentlyContinue
|
||||
if ($prop) {
|
||||
$prop.TestProp
|
||||
$prop.Close()
|
||||
}
|
||||
®.exe unload HKLM\ANSIBLE > $null
|
||||
exit 0
|
||||
register: remove_prop_in_hive_result
|
||||
|
||||
- win_command: reg.exe unload HKLM\ANSIBLE
|
||||
|
||||
- name: assert result of remove hive key property
|
||||
assert:
|
||||
that:
|
||||
@@ -665,13 +669,15 @@
|
||||
|
||||
- name: get result of remove key in loaded hive (check mode)
|
||||
win_shell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
®.exe load HKLM\ANSIBLE C:\Users\Default\NTUSER.dat > $null
|
||||
Test-Path -Path HKLM:\ANSIBLE\NewKey
|
||||
[GC]::Collect()
|
||||
[GC]::WaitForPendingFinalizers()
|
||||
®.exe unload HKLM\ANSIBLE > $null
|
||||
exit 0
|
||||
register: remove_key_in_hive_result_check
|
||||
|
||||
- win_command: reg.exe unload HKLM\ANSIBLE
|
||||
|
||||
- name: assert result of removekey in loaded hive (check mode)
|
||||
assert:
|
||||
that:
|
||||
@@ -688,13 +694,15 @@
|
||||
|
||||
- name: get result of remove key in loaded hive
|
||||
win_shell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
®.exe load HKLM\ANSIBLE C:\Users\Default\NTUSER.dat > $null
|
||||
Test-Path -Path HKLM:\ANSIBLE\NewKey
|
||||
[GC]::Collect()
|
||||
[GC]::WaitForPendingFinalizers()
|
||||
®.exe unload HKLM\ANSIBLE > $null
|
||||
exit 0
|
||||
register: remove_key_in_hive_result
|
||||
|
||||
- win_command: reg.exe unload HKLM\ANSIBLE
|
||||
|
||||
- name: assert result of remove key in loaded hive
|
||||
assert:
|
||||
that:
|
||||
|
||||
Reference in New Issue
Block a user