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

win_lgpo.py line 5368; AttributeError: 'OrderedDict' object has no attribute 'lower' #47784

Open
jpsv opened this issue May 22, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@jpsv
Copy link
Contributor

commented May 22, 2018

Description of Issue/Question

When using SaltStack to configure local group policy, I run into the same error on multiple machines and any SLS file that specifies a GPO element:

      ID: active_hours_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 1878, in call
              **cdata['kwargs'])
            File "c:\salt\bin\lib\site-packages\salt\loader.py", line 1823, in wrapper
              return f(*args, **kwargs)
            File "c:\salt\bin\lib\site-packages\salt\states\win_lgpo.py", line 306, in set_
              adml_language=adml_language)
            File "c:\salt\bin\lib\site-packages\salt\modules\win_lgpo.py", line 5368, in set_
              log.debug('setting == %s', _admTemplateData[policy_namespace][policy_name].lower())
          AttributeError: 'OrderedDict' object has no attribute 'lower'
 Started: 17:31:24.824000
Duration: 9370.0 ms
 Changes:

Setup

# activehours.sls
active_hours_policy:
  lgpo.set:
    - computer_policy:
        'ActiveHours':
            'ActiveHoursEndtime': 8
            'ActiveHoursEndTime': 19
    - adml_language: en-US
    - onchanges_in:
      - cmd: run_gpupdate

run_gpupdate:
  cmd.run:
    - name: 'gpupdate.exe /force'
# screensaver.sls
Password Protect Idle Workstation:
  lgpo.set:
    - user_policy:
        "Enable screen saver": Enabled
        "Password protect the screen saver": Enabled
        "Screen saver timeout":
            "ScreenSaverTimeOutFreqSpin": "720"

Run myscript:
  cmd.run:
    - name: 'gpupdate.exe /force'

This SLS file WORKS:

# unset-wallpaper.sls
Wallpaper Policy:
  lgpo.set:
    - user_policy:
        Desktop Wallpaper: Not Configured

Run myscript:
  cmd.run:
    - name: gpupdate.exe /force

Steps to Reproduce Issue

Happens on every Windows 10 machine I try to configure, starting with a fresh install of Windows 10 and updating it to 1803, then installing SaltStack 2018.3.0 Python2.

To reproduce, configure a group policy that has required elements.

Versions Report

Minion:

  • Windows 10 1803
  • Saltstack Py2 2018.3.0

Master:

Salt Version:
           Salt: 2018.3.0

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.5.3
      docker-py: Not Installed
          gitdb: 2.0.0
      gitpython: 2.1.1
          ioflo: Not Installed
         Jinja2: 2.9.4
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.13 (default, Nov 24 2017, 17:33:09)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 2.0.1
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1

System Versions:
           dist: debian 9.4
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 4.13.13-2-pve
         system: Linux
        version: debian 9.4

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

@Ch3LL

This comment has been minimized.

Copy link
Contributor

commented May 23, 2018

@twangboy i know you have been doing a lot of work around this module. Any ideas here?

@Ch3LL Ch3LL added this to the Blocked milestone May 23, 2018

lomeroe added a commit to lomeroe/salt that referenced this issue Oct 19, 2018

@lomeroe

This comment has been minimized.

Copy link
Contributor

commented Oct 19, 2018

@jpsv The values for ActiveHoursStartTime and ActiveHoursEndTime must be entered as they appear in the gpedit.msc gui

In other words:

# activehours.sls
active_hours_policy:
  lgpo.set:
    - computer_policy:
        'ActiveHours':
            'ActiveHoursStartTime': '8 AM'
            'ActiveHoursEndTime': '7 PM'
    - adml_language: en-US
    - onchanges_in:
      - cmd: run_gpupdate

However, in PY3 2018.3.2, this policy will fail to apply in some circumstances. However, it does appear that the fix for the issue should be in the PY3 2018.3.3 version (PR #48587 I believe), when it is released. PY2 versions do not have that particular issue.

edited to reword

lomeroe added a commit to lomeroe/salt that referenced this issue Oct 24, 2018

lomeroe added a commit to lomeroe/salt that referenced this issue Nov 2, 2018

gitebra pushed a commit to gitebra/salt that referenced this issue Nov 14, 2018

Merge remote-tracking branch 'upstream/develop' into develop
* upstream/develop: (39 commits)
  Add documentation for ssh_host configuration under Saltify
  parted: support variable length output for print
  Reduce the number of days an issue is stale by 10
  Remove flaky test
  Adds timeouts to the manage.down runner
  Fix test_matcher on Windows
  Updating the swap function in the mount.swap function also check the device name when checking the fstab data.  Updating tests to reflect new behavior.
  update to use a single line if statement when dealing with prepended text
  add runTest method to class for PY2
  add a test for saltstack#47784
  change backslashes in comment string to fix lint error
  add fix/test for saltstack#50079
  more lint fixes
  lint fixes in test
  update test to actually work
  add missing comma in function call
  Log a warning message instead of an exception when a SID cannot be converted to a username (for user rights assignments)
  capture and print exception information
  update method for creating size field of **delvals items for py3 compatibility
  fix clobbering of admx_search_results which was keeping some policies from being properly detected
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.