unarchive - ensure src is an absolute path before picking handler (#80738)

pull/80879/head
Sloane Hertel 1 year ago committed by GitHub
parent 86e7cd57b7
commit 09b4cae4fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- unarchive - fix unarchiving sources that are copied to the remote node using a relative temporory directory path (https://github.com/ansible/ansible/issues/80710).

@ -1054,6 +1054,9 @@ def main():
if not os.access(src, os.R_OK):
module.fail_json(msg="Source '%s' not readable" % src)
# ensure src is an absolute path before picking handlers
src = os.path.abspath(src)
# skip working with 0 size archives
try:
if os.path.getsize(src) == 0:

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -eux
ansible-playbook -i ../../inventory runme.yml -v "$@"
# https://github.com/ansible/ansible/issues/80710
ANSIBLE_REMOTE_TMP=./ansible ansible-playbook -i ../../inventory test_relative_tmp_dir.yml -v "$@"

@ -0,0 +1,4 @@
- hosts: all
gather_facts: no
roles:
- { role: ../unarchive }

@ -0,0 +1,10 @@
- hosts: all
gather_facts: no
tasks:
- include_role:
name: ../setup_remote_tmp_dir
- include_role:
name: ../setup_gnutar
- include_tasks: tasks/prepare_tests.yml
- include_tasks: tasks/test_tar.yml
Loading…
Cancel
Save