Workaround getpwnam in auth test for MacOSX

This commit is contained in:
Ch3LL 2018-03-27 15:18:29 -04:00
parent 554400e067
commit 4f1c42c0e3
No known key found for this signature in database
GPG Key ID: 132B55A7C13EFA73

View File

@ -59,12 +59,18 @@ class AuthTest(ShellCase):
def setUp(self):
for user in (self.userA, self.userB):
try:
if salt.utils.is_darwin() and user not in str(self.run_call('user.list_users')):
# workaround for https://github.com/saltstack/salt-jenkins/issues/504
raise KeyError
pwd.getpwnam(user)
except KeyError:
self.run_call('user.add {0} createhome=False'.format(user))
# only put userB into the group for the group auth test
try:
if salt.utils.is_darwin() and self.group not in str(self.run_call('group.info {0}'.format(self.group))):
# workaround for https://github.com/saltstack/salt-jenkins/issues/504
raise KeyError
grp.getgrnam(self.group)
except KeyError:
self.run_call('group.add {0}'.format(self.group))