salt icon indicating copy to clipboard operation
salt copied to clipboard

module win_useradd not available in salt-minion 17.2

Open csakoda opened this issue 12 years ago • 10 comments

After upgrading some windows minions to 17.2, I noticed that the user module (and many other win_ modules) were missing:

[root@ip-10-0-2-140 pillar]# salt www9 user.info root
www9:
    "user.getent" is not available.
[root@ip-10-0-2-140 pillar]# salt www9 user.add test
www9:
    "user.info" is not available.
[root@ip-10-0-2-140 pillar]# salt www9 group.add testuser
www9:
    "user.add" is not available.

Investigating some, I found that the full pywin32 egg is no longer being included in the install of the salt-minion on windows. When I copied and old version of the egg into C:\salt\salt-0.17.2.win-amd64, it resolved the issue and all the modules returned, though the minion complained about a bunch of dupe modules:

C:\salt\salt-0.17.2.win-amd64\msgpack_python-0.3.0-py2.7-win-amd64.egg\msgpack\_
packer.py:3: UserWarning: Module win32api was already imported from C:\salt\salt
-0.17.2.win-amd64\win32api.pyd, but c:\salt\salt-0.17.2.win-amd64\pywin32-216-py
2.7-win-amd64.egg is being added to sys.path
C:\salt\salt-0.17.2.win-amd64\msgpack_python-0.3.0-py2.7-win-amd64.egg\msgpack\_
packer.py:3: UserWarning: Module pywintypes was already imported from C:\salt\sa
lt-0.17.2.win-amd64\pywintypes27.dll, but c:\salt\salt-0.17.2.win-amd64\pywin32-
216-py2.7-win-amd64.egg is being added to sys.path
C:\salt\salt-0.17.2.win-amd64\msgpack_python-0.3.0-py2.7-win-amd64.egg\msgpack\_
packer.py:3: UserWarning: Module winerror was already imported from C:\salt\salt
-0.17.2.win-amd64\library.zip\winerror.pyc, but c:\salt\salt-0.17.2.win-amd64\py
win32-216-py2.7-win-amd64.egg is being added to sys.path
C:\salt\salt-0.17.2.win-amd64\msgpack_python-0.3.0-py2.7-win-amd64.egg\msgpack\_
packer.py:3: UserWarning: Module win32com was already imported from C:\salt\salt
-0.17.2.win-amd64\library.zip\win32com\__init__.pyc, but c:\salt\salt-0.17.2.win
-amd64\pywin32-216-py2.7-win-amd64.egg is being added to sys.path
C:\salt\salt-0.17.2.win-amd64\msgpack_python-0.3.0-py2.7-win-amd64.egg\msgpack\_
packer.py:3: UserWarning: Module pythoncom was already imported from C:\salt\sal
t-0.17.2.win-amd64\pythoncom27.dll, but c:\salt\salt-0.17.2.win-amd64\pywin32-21
6-py2.7-win-amd64.egg is being added to sys.path

So my "solution" seems hacky at best, not sure what the proper fix is, though it did make the needed modules work:

[root@ip-10-0-2-140 pillar]# salt www9 user.add testuser
www9:
    True

csakoda avatar Dec 23 '13 20:12 csakoda

Thanks for pointing this out! I'll make sure that pywin32 is bundled in correctly.

UtahDave avatar Dec 23 '13 21:12 UtahDave

@csakoda could you test for this on the recently uploaded 0.17.4 installers?

UtahDave avatar Dec 26 '13 19:12 UtahDave

For what it's worth, I compiled the 0.17.14 develop branch on Windows 7 (32-bit) and this worked OK when I tested it today.

Geo23589 avatar Dec 31 '13 04:12 Geo23589

I experiencing the same issues with 0.17.4 binaries. I can't get any of the win_ modules to work. (Fresh install of Server 2008R2)

bigmstone avatar Jan 10 '14 05:01 bigmstone

I've done a bunch of bug fixing and cherry picking to make try to stabilize the Windows minion.

I've built a 0.17.4-2 installer that can be found here: http://docs.saltstack.com/downloads/Salt-Minion-0.17.4-2-AMD64-Setup.exe

I've only built a 64 bit version for now. Could you test this?

UtahDave avatar Jan 10 '14 22:01 UtahDave

Also, please uninstall the previous version of the Salt Minion and make sure the c:\salt directory is deleted before installing this one.

Thanks!

UtahDave avatar Jan 10 '14 22:01 UtahDave

$ sudo salt 'WIN-2RN1BAS2LRE.domain.local' system.get_computer_name
WIN-2RN1BAS2LRE.domain.local:
    "system.get_computer_name" is not available.

I'm new to salt so I want to make sure I'm not sending you a wild goose chase. This is a fresh install of Server 2008 R2. Installed python, then Salt. Should there be anything else needed for the win_system module to work? Is python even needed or is it packaged with the installer?

bigmstone avatar Jan 10 '14 22:01 bigmstone

get_computer_name is a new function that will be in Hydrogen.

You can see what functions are available by running:

sudo salt 'minion-name' sys.doc system

If you want the latest system module, you can download the win_system.py from the develop branch and drop it in /srv/salt/_modules, then run salt 'minion' saltutil.sync_modules.

UtahDave avatar Jan 10 '14 22:01 UtahDave

0.17.4-2 worked for me

[root@ip-10-10-2-49 salt]# salt staging-www-1 user.list_users staging-www-1: - Guest

Thank you @UtahDave!

csakoda avatar Jan 15 '14 23:01 csakoda

Can this issue be closed now?

UtahDave avatar Jan 22 '14 16:01 UtahDave