"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "salt/modules/win_useradd.py" between
salt-2019.2.0.tar.gz and salt-2019.2.1.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

win_useradd.py  (salt-2019.2.0):win_useradd.py  (salt-2019.2.1)
skipping to change at line 12 skipping to change at line 12
''' '''
Module for managing Windows Users Module for managing Windows Users
.. important:: .. important::
If you feel that Salt should be using this module to manage users on a If you feel that Salt should be using this module to manage users on a
minion, and it is using a different module (or gives an error similar to minion, and it is using a different module (or gives an error similar to
*'user.info' is not available*), see :ref:`here *'user.info' is not available*), see :ref:`here
<module-provider-override>`. <module-provider-override>`.
:depends: :depends:
- pythoncom
- pywintypes - pywintypes
- win32api - win32api
- win32con - win32con
- win32net - win32net
- win32netcon - win32netcon
- win32profile - win32profile
- win32security - win32security
- win32ts - win32ts
- wmi - wmi
skipping to change at line 41 skipping to change at line 40
try: try:
from shlex import quote as _cmd_quote # pylint: disable=E0611 from shlex import quote as _cmd_quote # pylint: disable=E0611
except Exception: except Exception:
from pipes import quote as _cmd_quote from pipes import quote as _cmd_quote
# Import Salt libs # Import Salt libs
import salt.utils.args import salt.utils.args
import salt.utils.dateutils import salt.utils.dateutils
import salt.utils.platform import salt.utils.platform
import salt.utils.winapi
from salt.ext import six from salt.ext import six
from salt.ext.six import string_types from salt.ext.six import string_types
from salt.exceptions import CommandExecutionError from salt.exceptions import CommandExecutionError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
try: try:
import pywintypes import pywintypes
import wmi import wmi
import pythoncom
import win32api import win32api
import win32con import win32con
import win32net import win32net
import win32netcon import win32netcon
import win32profile import win32profile
import win32security import win32security
import win32ts import win32ts
HAS_WIN32NET_MODS = True HAS_WIN32NET_MODS = True
except ImportError: except ImportError:
HAS_WIN32NET_MODS = False HAS_WIN32NET_MODS = False
skipping to change at line 973 skipping to change at line 972
# Look for an existing user with the new name # Look for an existing user with the new name
new_info = info(new_name) new_info = info(new_name)
if new_info: if new_info:
raise CommandExecutionError( raise CommandExecutionError(
'User \'{0}\' already exists'.format(new_name) 'User \'{0}\' already exists'.format(new_name)
) )
# Rename the user account # Rename the user account
# Connect to WMI # Connect to WMI
pythoncom.CoInitialize() with salt.utils.winapi.Com():
c = wmi.WMI(find_classes=0) c = wmi.WMI(find_classes=0)
# Get the user object # Get the user object
try: try:
user = c.Win32_UserAccount(Name=name)[0] user = c.Win32_UserAccount(Name=name)[0]
except IndexError: except IndexError:
raise CommandExecutionError('User \'{0}\' does not exist'.format(name)) raise CommandExecutionError('User \'{0}\' does not exist'.format(name))
# Rename the user # Rename the user
result = user.Rename(new_name)[0] result = user.Rename(new_name)[0]
 End of changes. 4 change blocks. 
4 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)