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

[BUG] lgpo.set fails on first run #65411

Closed
twangboy opened this issue Oct 16, 2023 · 2 comments
Closed

[BUG] lgpo.set fails on first run #65411

twangboy opened this issue Oct 16, 2023 · 2 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior lgpo

Comments

@twangboy
Copy link
Contributor

twangboy commented Oct 16, 2023

Description
The lgpo.set state fails on first run if the policy directory is missing. It attempts to create the directory, but fails setting permissions to the directory. On the 2nd run, the directory is present, so the state continues.

The directory that may be missing on a brand new machine:

C:\Windows\System32\GroupPolicy\User

Remove the above directory and run this command to trigger the issue.

salt '*' lgpo.set_user_policy "Control Panel\Display\Disable the Display Control Panel" Enabled 

Observe following stacktrace is shown:

Traceback (most recent call last):
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\state.py", line 2381, in call
    ret = self.states[cdata["full"]](
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\loader\lazy.py", line 159, in _call_
    ret = self.loader.run(run_func, *args, **kwargs)
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\loader\lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\loader\lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\loader\lazy.py", line 1293, in wrapper
    return f(*args, **kwargs)
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\states\win_lgpo.py", line 545, in set_
    ret = __salt_["lgpo.set"](
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\loader\lazy.py", line 159, in _call_
    ret = self.loader.run(run_func, *args, **kwargs)
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\loader\lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\loader\lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\modules\win_lgpo.py", line 10490, in set_
    _ret = _writeAdminTemplateRegPolFile(
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\modules\win_lgpo.py", line 8139, in _writeAdminTemplateRegPolFile
    write_reg_pol_data(
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\utils\win_lgpo_reg.py", line 141, in write_reg_pol_data
    salt.modules.win_file.makedirs_(policy_file_path)
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\modules\win_file.py", line 1730, in makedirs_
    mkdir(
File "C:\Program Files\Salt Project\Salt\lib\site-packages\salt\modules\win_file.py", line 1600, in mkdir
    _utils_["dacl.set_perms"](
NameError: name '_utils_' is not defined

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
3006.3

Additional context
https://jira.eng.vmware.com/browse/VRAE-55875

@twangboy twangboy added Bug broken, incorrect, or confusing behavior needs-triage labels Oct 16, 2023
@twangboy twangboy mentioned this issue Oct 16, 2023
3 tasks
@OrangeDog OrangeDog added the lgpo label Oct 16, 2023
@OrangeDog
Copy link
Contributor

According to the stacktrace, it's because someone typoed __utils__ as _utils_.

@whytewolf
Copy link
Collaborator

According to the stacktrace, it's because someone typoed __utils__ as _utils_.

that wasn't the issue. that was just a copy and paste error that snipped the leading and ending _ to italicize.

@Ch3LL Ch3LL added this to the Sulfur v3006.4 milestone Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior lgpo
Projects
None yet
Development

No branches or pull requests

4 participants