Skip to content

Windows error when re-applying users: "if shell and lusr['shell'] != shell" #170

Open
@jpsv

Description

Salt-Master (salt 2017.7.4 (Nitrogen)) on Debian 9.3.0 netinstall VM.
Salt-Minion (salt 2017.7.4 (Nitrogen)) (just upgraded from 2017.7.2) on Windows 10 (version 1709 build 16289.248) default install on Dell XPS 13

   ----------
          ID: users_firstname.lastname_user
    Function: user.present
        Name: firstname.lastname
      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 1843, in call
                  **cdata['kwargs'])
                File "c:\salt\bin\lib\site-packages\salt\loader.py", line 1795, in wrapper
                  return f(*args, **kwargs)
                File "c:\salt\bin\lib\site-packages\salt\states\user.py", line 485, in present
                  win_description)
                File "c:\salt\bin\lib\site-packages\salt\states\user.py", line 126, in _changes
                  if shell and lusr['shell'] != shell:
              KeyError: 'shell'
     Started: 09:48:29.202000
    Duration: 16.0 ms
     Changes:
    ----------
          ID: users_firstname.lastname_user
    Function: file.directory
        Name: /home/firstname.lastname
      Result: False
     Comment: One or more requisite failed: users.users_firstname.lastname_user
     Changes:

On the Minion, I observe in the Salt Minion debug logs that the system is trying to find a registry key that doesn't exist, a sequentially increasing 4-digit number for the Windows SID. My Pillar (Same error if Shell is omitted or defined as /bin/sh):

users:
  ## Minimal required pillar values
# auser:
#   fullname: A User

  ## Full list of pillar values
  firstname.lastname:
    fullname: Firsty Lasterson
    password: plaintestbullshit
    enforce_password: True
    # WARNING: If 'empty_password' is set to True, the 'password' statement
    # will be ignored by enabling password-less login for the user.
    empty_password: False
    hash_password: False
    prime_group:
      name: Administrators
    shell: ComSpec


    user_files:
      enabled: True
      # 'source' allows you to define an arbitrary directory to sync, useful to use for default files.
      # should be a salt fileserver path either with or without 'salt://'
      # if not present, it defaults to 'salt://users/files/user/<username>
      source: users/files/default
      template: jinja
      # You can specify octal mode for files and symlinks that will be copied. Since version 2016.11.0
      # it's possible to use 'keep' for file_mode, to preserve file original mode, thus you can save
      # execution bit for example.
      file_mode: keep
      sym_mode: 640

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions