Hello,
When extracting an empty archive, the unarchive module exists with an error:
“failed: [localhost] (item=/tmp/foo/bar.zip) => {“changed”: false, “item”: “/tmp/foo/bar.zip”, “msg”: “Failed to find handler for "/tmp/foo/bar.zip". Make sure the required command to extract the file is installed. Command "/bin/gtar" could not handle archive. Command "/bin/unzip" could not handle archive.”}”
unzip exists with error code 1 and warning message “warning [/tmp/foo/bar.zip]: zipfile is empty”.
Ansible just stops there with a strange error message (took me quite some time to discover the cause).
I tried to handle it with “failed_when” but it seems that you can’t register the command result in a var.
The only way to prevent this I found is using “ignore_errors” which I don’t want to use as I still want to stop if a “true” error happens.
Is there a proper way to handle this case ?
I know it’s not really a bug as unzip still exists with a value >0 but I think there should be a in-application way to handle this.
ansible-playbook 2.6.4
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Thank you in advance.