1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add two more failure conditions to unarchive (#51914)

This commit is contained in:
Kevin 2019-02-13 13:40:26 -05:00 committed by Sam Doran
parent cdb53ff1a4
commit c512471428
2 changed files with 8 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- unarchive - add two more error conditions to unarchive to present more accurate error message (https://github.com/ansible/ansible/issues/51848)

View file

@ -172,6 +172,8 @@ MOD_TIME_DIFF_RE = re.compile(r': Mod time differs$')
EMPTY_FILE_RE = re.compile(r': : Warning: Cannot stat: No such file or directory$') EMPTY_FILE_RE = re.compile(r': : Warning: Cannot stat: No such file or directory$')
MISSING_FILE_RE = re.compile(r': Warning: Cannot stat: No such file or directory$') MISSING_FILE_RE = re.compile(r': Warning: Cannot stat: No such file or directory$')
ZIP_FILE_MODE_RE = re.compile(r'([r-][w-][SsTtx-]){3}') ZIP_FILE_MODE_RE = re.compile(r'([r-][w-][SsTtx-]){3}')
INVALID_OWNER_RE = re.compile(r': Invalid owner')
INVALID_GROUP_RE = re.compile(r': Invalid group')
def crc32(path): def crc32(path):
@ -730,6 +732,10 @@ class TgzArchive(object):
out += line + '\n' out += line + '\n'
if MISSING_FILE_RE.search(line): if MISSING_FILE_RE.search(line):
out += line + '\n' out += line + '\n'
if INVALID_OWNER_RE.search(line):
out += line + '\n'
if INVALID_GROUP_RE.search(line):
out += line + '\n'
if out: if out:
unarchived = False unarchived = False
return dict(unarchived=unarchived, rc=rc, out=out, err=err, cmd=cmd) return dict(unarchived=unarchived, rc=rc, out=out, err=err, cmd=cmd)