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

Ensures popping lgpo.secedit_data does not throw KeyError #56290

Merged
merged 4 commits into from
Mar 11, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion salt/modules/win_lgpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5526,7 +5526,7 @@ def _write_secedit_data(inf_data):
# Success
if retcode == 0:
# Pop secedit data so it will always be current
__context__.pop('lgpo.secedit_data')
__context__.pop('lgpo.secedit_data', None)
return True
# Failure
return False
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/modules/test_win_lgpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,22 @@ def test_set_computer_policy_ClipboardRedirection(self):
'Not Configured',
[r'; Source file: c:\\windows\\system32\\grouppolicy\\machine\\registry.pol[\s]*; PARSING COMPLETED.'])

@destructiveTest
def test_set_computer_policy_GuestAccountStatus(self):
'''
Test setting/unsetting/changing GuestAccountStatus
'''
# disable GuestAccountStatus
self._testSeceditPolicy(
'GuestAccountStatus',
'Disabled',
[r'^EnableGuestAccount = 0'])
waynew marked this conversation as resolved.
Show resolved Hide resolved
# enable GuestAccountStatus
self._testSeceditPolicy(
'GuestAccountStatus',
'Enabled',
[r'^EnableGuestAccount = 1'])

@destructiveTest
def test_set_computer_policy_PasswordComplexity(self):
'''
Expand Down