salt: MacOS El Capitan user.present cause execution error

I’m just testing on a Mac minion, with a simple user.present state test. The user already exists, and the minion throws:

          ID: a-human
    Function: user.present
        Name: '***username***'
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/Library/Python/2.7/site-packages/salt/state.py", line 1703, in call
                  **cdata['kwargs'])
                File "/Library/Python/2.7/site-packages/salt/loader.py", line 1649, in wrapper
                  return f(*args, **kwargs)
                File "/Library/Python/2.7/site-packages/salt/states/user.py", line 457, in present
                  win_description)
                File "/Library/Python/2.7/site-packages/salt/states/user.py", line 92, in _changes
                  lshad = __salt__['shadow.info'](name)
                File "/Library/Python/2.7/site-packages/salt/modules/mac_shadow.py", line 151, in info
                  'login_failed_count': get_login_failed_count(name),
                File "/Library/Python/2.7/site-packages/salt/modules/mac_shadow.py", line 246, in get_login_failed_count
                  ret = _get_account_policy_data_value(name, 'failedLoginCount')
                File "/Library/Python/2.7/site-packages/salt/modules/mac_shadow.py", line 110, in _get_account_policy_data_value
                  raise CommandExecutionError('Unknown error: {0}'.format(exc.strerror))
              CommandExecutionError: Unknown error: Command Failed: dscl . -readpl /Users/leon accountPolicyData failedLoginCount
              Return Code: 181
              Output: No such plist path: failedLoginCount
              Error: <dscl_cmd> DS Error: -14261 (eDSUnknownMatchType)
     Started: 13:34:57.497287
    Duration: 64.237 ms

Master:

Salt Version:
           Salt: 2016.3.1

Dependency Versions:
           cffi: 1.7.0
       cherrypy: 6.0.2
       dateutil: 2.5.3
          gitdb: 0.6.4
      gitpython: 2.0.6
          ioflo: 1.5.5
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: 1.4.5
       M2Crypto: 0.24.0
           Mako: 1.0.4
   msgpack-pure: 0.1.3
 msgpack-python: 0.4.7
   mysql-python: 1.2.5
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.5 (default, Nov 20 2015, 02:00:19)
   python-gnupg: 0.3.8
         PyYAML: 3.11
          PyZMQ: 14.7.0
           RAET: 0.6.5
          smmap: 0.9.0
        timelib: 0.2.4
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: centos 7.2.1511 Core
        machine: x86_64
        release: 3.10.0-327.22.2.el7.x86_64
         system: Linux
        version: CentOS Linux 7.2.1511 Core

Minion:

Salt Version:
           Salt: 2016.3.0

Dependency Versions:
           cffi: 1.5.2
       cherrypy: 5.1.0
       dateutil: 1.5
          gitdb: 0.6.4
      gitpython: 1.0.2
          ioflo: 1.5.1
         Jinja2: 2.8
        libgit2: 0.23.4
        libnacl: 1.4.4
       M2Crypto: 0.24.0
           Mako: 1.0.4
   msgpack-pure: 0.1.3
 msgpack-python: 0.4.7
   mysql-python: 1.2.5
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: 0.23.3
         Python: 2.7.10 (default, Jul 14 2015, 19:46:27)
   python-gnupg: 0.3.8
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: 0.6.5
          smmap: 0.9.0
        timelib: 0.2.4
        Tornado: 4.3
            ZMQ: 4.1.2

System Versions:
           dist:
        machine: x86_64
        release: 14.5.0
         system: Darwin
        version: 10.10.5 x86_64

SLS:

a-human:
  user.present:
    - name: '***username***'
    - fullname: human-name
    - password: '***chopped***'
    - groups:
      - an-existing-group
    - require:
      - group: an-existing-group

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

Happening on macOS 11.1 Big Sur, as well, with more recent Salt versions.

Created a new trivial user via state.apply with this SLS:

buildbot_user:
  user.present:
    - name: buildbot
    - system: true
    - home: /opt/buildbot
    - shell: /bin/bash

Successfully created the account, and home directory, as expected, but subsequent state applications yield the error from the OP:

macos-build-###########:
----------
          ID: buildbot_user
    Function: user.present
        Name: buildbot
      Result: False
     Comment: Unknown error: Command Failed: dscl . -readpl /Users/buildbot accountPolicyData failedLoginCount
              Return Code: 181
              Output: No such plist path: failedLoginCount
              Error: <dscl_cmd> DS Error: -14261 (eDSUnknownMatchType)
     Started: 12:44:44.481546
    Duration: 51.36 ms
     Changes:

Salt Master:

Salt Version:
           Salt: 3001.4

Dependency Versions:
           cffi: Not Installed
       cherrypy: unknown
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
         Jinja2: 2.10
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: Not Installed
   pycryptodome: 3.4.7
         pygit2: Not Installed
         Python: 3.6.9 (default, Oct  8 2020, 12:12:24)
   python-gnupg: 0.4.1
         PyYAML: 3.12
          PyZMQ: 17.1.2
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5

System Versions:
           dist: ubuntu 18.04 Bionic Beaver
         locale: ISO-8859-1
        machine: x86_64
        release: 4.15.0-130-generic
         system: Linux
        version: Ubuntu 18.04 Bionic Beaver

Salt Minion:

Salt Version:
          Salt: 3002.2
 
Dependency Versions:
          cffi: 1.14.3
      cherrypy: unknown
      dateutil: 2.8.0
     docker-py: Not Installed
         gitdb: 2.0.6
     gitpython: 2.1.15
        Jinja2: 2.10.1
       libgit2: 1.1.0
      M2Crypto: 0.36.0
          Mako: 1.0.7
       msgpack: 1.0.0
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.19
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: 1.4.0
        Python: 3.9.1 (default, Jan  8 2021, 17:17:43)
  python-gnupg: 0.4.4
        PyYAML: 5.3.1
         PyZMQ: 19.0.2
         smmap: 3.0.2
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.3
 
System Versions:
          dist: darwin 20.2.0 
        locale: utf-8
       machine: x86_64
       release: 20.2.0
        system: Darwin
       version: 11.1 x86_64

The above PR should fix the issue with the stacktrace.