Merge pull request #38004 from terminalmage/issue37969

Fix regression in user/group mgmt for archive.extracted
This commit is contained in:
Mike Place 2016-12-02 11:28:48 -07:00 committed by GitHub
commit 1ac53e5196
2 changed files with 20 additions and 2 deletions

View file

@ -606,7 +606,7 @@ def extracted(name,
if user:
uid = __salt__['file.user_to_uid'](user)
if not uid:
if uid == '':
ret['comment'] = 'User {0} does not exist'.format(user)
return ret
else:
@ -614,7 +614,7 @@ def extracted(name,
if group:
gid = __salt__['file.group_to_gid'](group)
if not gid:
if gid == '':
ret['comment'] = 'Group {0} does not exist'.format(group)
return ret
else:

View file

@ -119,6 +119,24 @@ class ArchiveTest(integration.ModuleCase,
self._check_ext_remove(ARCHIVE_DIR, UNTAR_FILE)
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
def test_archive_extracted_with_root_user_and_group(self):
'''
test archive.extracted without skip_verify
only external resources work to check to
ensure source_hash is verified correctly
'''
ret = self.run_state('archive.extracted', name=ARCHIVE_DIR,
source=ARCHIVE_TAR_SOURCE, archive_format='tar',
source_hash=ARCHIVE_TAR_HASH,
user='root', group='root')
if 'Timeout' in ret:
self.skipTest('Timeout talking to local tornado server.')
self.assertSaltTrueReturn(ret)
self._check_ext_remove(ARCHIVE_DIR, UNTAR_FILE)
if __name__ == '__main__':
from integration import run_tests