From c51247142807ba012f37cc8c0ee1d5600a5542e3 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 13 Feb 2019 13:40:26 -0500 Subject: [PATCH] Add two more failure conditions to unarchive (#51914) --- changelogs/fragments/unarchive-fix-bad-user-and-group.yaml | 2 ++ lib/ansible/modules/files/unarchive.py | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 changelogs/fragments/unarchive-fix-bad-user-and-group.yaml diff --git a/changelogs/fragments/unarchive-fix-bad-user-and-group.yaml b/changelogs/fragments/unarchive-fix-bad-user-and-group.yaml new file mode 100644 index 0000000000..54d2ec9f48 --- /dev/null +++ b/changelogs/fragments/unarchive-fix-bad-user-and-group.yaml @@ -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) diff --git a/lib/ansible/modules/files/unarchive.py b/lib/ansible/modules/files/unarchive.py index 707e94c49c..80a97f15fd 100644 --- a/lib/ansible/modules/files/unarchive.py +++ b/lib/ansible/modules/files/unarchive.py @@ -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$') 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}') +INVALID_OWNER_RE = re.compile(r': Invalid owner') +INVALID_GROUP_RE = re.compile(r': Invalid group') def crc32(path): @@ -730,6 +732,10 @@ class TgzArchive(object): out += line + '\n' if MISSING_FILE_RE.search(line): out += line + '\n' + if INVALID_OWNER_RE.search(line): + out += line + '\n' + if INVALID_GROUP_RE.search(line): + out += line + '\n' if out: unarchived = False return dict(unarchived=unarchived, rc=rc, out=out, err=err, cmd=cmd)