File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ def gid_to_group(gid):
8181
8282 salt '*' file.gid_to_group S-1-5-21-626487655-2533044672-482107328-1010
8383 '''
84+ if not gid :
85+ return False
8486 sid = win32security .GetBinarySid (gid )
8587 name , domain , account_type = win32security .LookupAccountSid (None , sid )
8688 return name
Original file line number Diff line number Diff line change 2828import logging
2929import sys
3030
31+ # Import salt libs
32+ import salt .utils
33+
3134log = logging .getLogger (__name__ )
3235
3336
@@ -96,7 +99,7 @@ def _changes(name,
9699 if shell :
97100 if lusr ['shell' ] != shell :
98101 change ['shell' ] = shell
99- if 'shadow.info' in __salt__ :
102+ if 'shadow.info' in __salt__ and 'shadow.default_hash' in __salt__ :
100103 if password :
101104 default_hash = __salt__ ['shadow.default_hash' ]()
102105 if lshad ['passwd' ] == default_hash \
@@ -369,7 +372,7 @@ def present(name,
369372 if all ((password , 'shadow.info' in __salt__ )):
370373 __salt__ ['shadow.set_password' ](name , password )
371374 spost = __salt__ ['shadow.info' ](name )
372- if spost ['passwd' ] != password :
375+ if spost ['passwd' ] != password and not salt . utils . is_windows () :
373376 ret ['comment' ] = 'User {0} created but failed to set' \
374377 ' password to {1}' .format (name , password )
375378 ret ['result' ] = False
You can’t perform that action at this time.
0 commit comments