Closed DaveOHenry closed 7 years ago
The error indicates an escape character was detected. As a workaround, try doubling the backslashes.
Thanks for the hint. So the documentation is at least misleading. I tried with double backslashes and the state runs now, but fails with an exception:
win_server:
----------
ID: group_policy
Function: lgpo.set
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "c:\salt\bin\lib\site-packages\salt\state.py", line 1744, in call
**cdata['kwargs'])
File "c:\salt\bin\lib\site-packages\salt\loader.py", line 1702, in wrapper
return f(*args, **kwargs)
File "c:\salt\bin\lib\site-packages\salt\states\win_lgpo.py", line 237, in set_
hierarchical_return=False)
File "c:\salt\bin\lib\site-packages\salt\modules\win_lgpo.py", line 4016, in get
class_vals[policy_name] = _getScriptSettingsFromIniFile(_pol)
File "c:\salt\bin\lib\site-packages\salt\modules\win_lgpo.py", line 3630, in _getScriptSettingsFromIniFile
_existingData = _existingData.split('\r\n')
AttributeError: 'NoneType' object has no attribute 'split'
Started: 11:30:39.840000
Duration: 2266.0 ms
Changes:
Summary for win_server
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 2.266 s
@DaveOHenry I think the error you are hitting was fixed by PR #37262. I don't think it has been back-ported into 2016.11 yet.
When I look a the documentation for the state, it shows using double backslashes, you are seeing different on your end?
@DaveOHenry I see what you mean on the docs now (I was looking at the code and not the rendered web pages).
@DaveOHenry does the pr @lomeroe fix the Nontype error you are running into?
Either way I will mark this as a documentation bug as the double backslashes are in the code but not showing up in the web. Thanks
@Ch3LL that's how the double backslashes print when using sys.doc also. Might be a larger issue than appears. If I remember right, I needed to use \\
to print \
, even in triple-single-quoted docstrings. To get a \\
to print as \\
, I needed to explicitly specify raw strings. i.e. r'''
Thanks a lot for your feedback @Ch3LL @lomeroe . It is working for me with the win_lgpo.py file from PR https://github.com/saltstack/salt/pull/37262. Finally there is a simple way to automate the GPO stuff. I really appreciate your great work here.
Forgot to ask: Will the PR make it to 2016.11.x?
@DaveOHenry yeah, I'll try to get it (along with several other bug-fixes) backported in the next few days so it makes the next point release
@DaveOHenry The PR is now in the 2016.11 branch and will be included in the 2016.11.3 release.
Description of Issue/Question
I was really looking forward to using the new gpo state, but unfortunately it is not working for me. I looked up the names / values of the policies in gpedit.msc and tried to follow the example configuration from https://docs.saltstack.com/en/latest/ref/states/all/salt.states.win_lgpo.html . The documentation looks pretty straightforward, but maybe I missed something or there is some kind of syntax error in my config?
Setup
/srv/salt/windows/init.sls
Steps to Reproduce Issue
execute:
error:
Versions Report