salt icon indicating copy to clipboard operation
salt copied to clipboard

Fix Windows user add.

Open UtahDave opened this issue 13 years ago • 10 comments

While fixing bug #4484 I came across this error. Once #4484 was fixed, you can now create the user. But now the second time you run the state you get this error:

ubuntu@ip-10-195-227-27:/srv/salt$ sudo salt 'lk*' state.sls testuser
lkjlkj:
----------
    State: - user
    Name:      testuser
    Function:  present
        Result:    True
        Comment:   New user testuser created
        Changes:   comment: 
                   profile: 
                   name: testuser
                   groups: ['Users']
                   active: Yes
                   home: 
                   fullname: 
                   logonscript: 

ubuntu@ip-10-195-227-27:/srv/salt$ sudo salt 'lk*' state.sls testuser
lkjlkj:
----------
    State: - user
    Name:      testuser
    Function:  present
        Result:    False
        Comment:   An exception occurred in this state: Traceback (most recent call last):
  File "C:\salt\python27\lib\site-packages\salt\state.py", line 1217, in call
    ret = self.states[cdata['full']](*cdata['args'])
  File "C:\salt\python27\lib\site-packages\salt\states\user.py", line 255, in present
    homephone)
  File "C:\salt\python27\lib\site-packages\salt\states\user.py", line 69, in _changes
    if __salt__['file.gid_to_group'](gid or lusr['gid']) in \
KeyError: 'gid'

        Changes:   
ubuntu@ip-10-195-227-27:/srv/salt$ 

UtahDave avatar Apr 22 '13 19:04 UtahDave

Can you help me with this issue please?

I am running salt-0.16.3.win32. My usermgt.sls reads like this:

Jenkins:
  user.present:
    - fullname: 'Continuous Integration Account'
    - groups: 
      - JenkinsGroup

When running "salt-call state.highstate", I receive this error:

    State: - user←[0m
    ←[0;31mName:      Jenkins←[0m
    ←[0;31mFunction:  present←[0m
        ←[0;31mResult:    False←[0m
        ←[0;31mComment:   An exception occurred in this state: Traceback (most r
ecent call last):
  File "salt/state.py", line 1239, in call
  File "salt/states/user.py", line 367, in present
TypeError: add() got an unexpected keyword argument 'createhome'
←[0m
←[0;31m        Changes:   ←[0m

FWIW: Just prior to running salt-call, I had deleted the user Jenkins which I had created manually.

emmellee avatar Oct 10 '13 21:10 emmellee

Ah, I think this was an issue that was fixed for 0.16.4 and 0.17.0. Could you try upgrading?

basepi avatar Oct 11 '13 20:10 basepi

will do, thanks.

emmellee avatar Oct 12 '13 01:10 emmellee

I've had absolutely no luck in my attempts to upgrade from 16.3 to 17.0. I received a "msgpack.exceptions.UnpackValueError" error when running salt-call even though I'd removed 16.3 from the server prior to the 17.0 installation. I've attempted the 17.0 installation several times to no avail.

emmellee avatar Oct 16 '13 18:10 emmellee

This is a known issue with upgrading to 0.17.0. Remove C:\salt\var\cache\salt (or whatever the path is to the salt cachedir), and that error should clear.

terminalmage avatar Oct 16 '13 18:10 terminalmage

ah, but I did. I removed all of c:\salt.

emmellee avatar Oct 16 '13 18:10 emmellee

Did you restart the salt-minion service?

terminalmage avatar Oct 16 '13 18:10 terminalmage

I ensured the service was removed after each un-install.

emmellee avatar Oct 16 '13 18:10 emmellee

And ensured it was re-installed and started prior to my salt-call test.

After several tries, I reverted back to a 16.3 install and no error.

emmellee avatar Oct 16 '13 18:10 emmellee

I haven't tried a reboot because that's a rather drastic measure in my environment.

emmellee avatar Oct 16 '13 18:10 emmellee