summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/unarchive
diff options
context:
space:
mode:
authorJean Raby <jean@raby.sh>2021-12-23 22:01:56 +0100
committerGitHub <noreply@github.com>2021-12-23 22:01:56 +0100
commit594b11dc0c9ca6f5bc0b607dc00548936dea8542 (patch)
tree8778a9fd2c6632d1385f0a0daa0134f9b2eb76a6 /test/integration/targets/unarchive
parentDisable the _distutils_hack in newer setuptools (#76600) (diff)
downloadansible-594b11dc0c9ca6f5bc0b607dc00548936dea8542.tar.xz
ansible-594b11dc0c9ca6f5bc0b607dc00548936dea8542.zip
unarchive: Keep stderr when pick_handler fails (#76365)
* fixes #28977 * Include the original error message when pick_handler fails * Add a test to unarchive a tar file with an invalid extra option * add a changelog
Diffstat (limited to 'test/integration/targets/unarchive')
-rw-r--r--test/integration/targets/unarchive/tasks/main.yml1
-rw-r--r--test/integration/targets/unarchive/tasks/test_invalid_options.yml27
2 files changed, 28 insertions, 0 deletions
diff --git a/test/integration/targets/unarchive/tasks/main.yml b/test/integration/targets/unarchive/tasks/main.yml
index baa2a8cf22..60bdd1b08f 100644
--- a/test/integration/targets/unarchive/tasks/main.yml
+++ b/test/integration/targets/unarchive/tasks/main.yml
@@ -18,3 +18,4 @@
- import_tasks: test_download.yml
- import_tasks: test_unprivileged_user.yml
- import_tasks: test_different_language_var.yml
+- import_tasks: test_invalid_options.yml
diff --git a/test/integration/targets/unarchive/tasks/test_invalid_options.yml b/test/integration/targets/unarchive/tasks/test_invalid_options.yml
new file mode 100644
index 0000000000..68a0621355
--- /dev/null
+++ b/test/integration/targets/unarchive/tasks/test_invalid_options.yml
@@ -0,0 +1,27 @@
+- name: create our tar unarchive destination
+ file:
+ path: '{{remote_tmp_dir}}/test-unarchive-tar'
+ state: directory
+
+- name: unarchive a tar file with an invalid option
+ unarchive:
+ src: '{{remote_tmp_dir}}/test-unarchive.tar'
+ dest: '{{remote_tmp_dir}}/test-unarchive-tar'
+ remote_src: yes
+ extra_opts:
+ - "--invalid-éxtra-optら"
+ ignore_errors: yes
+ register: unarchive
+
+- name: verify that the invalid option is in the error message
+ assert:
+ that:
+ - "unarchive is failed"
+ - "unarchive['msg'] is search(msg)"
+ vars:
+ msg: "Unable to list files in the archive: /.*/(tar|gtar): unrecognized option '--invalid-éxtra-optら'"
+
+- name: remove our tar unarchive destination
+ file:
+ path: '{{remote_tmp_dir}}/test-unarchive-tar'
+ state: absent