Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Unarchive exclude throws erroneous error #3988

Closed
michelleperz opened this issue Jun 20, 2016 · 4 comments
Closed

Unarchive exclude throws erroneous error #3988

michelleperz opened this issue Jun 20, 2016 · 4 comments

Comments

@michelleperz
Copy link

ISSUE TYPE
  • Bug Report
COMPONENT NAME

unarchive exclude parameter

ANSIBLE VERSION
 ansible --version
ansible 2.1.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION

No changes

OS / ENVIRONMENT

RHEL 7 managing RHEL 7

SUMMARY

When using the exclude parameter to exclude various directories, I get an error that one of my excluded directories does not exist even though it does. However, when I use ignore_errors, the directory does get successfully excluded in the unarchive on the target machine.

STEPS TO REPRODUCE
  1. Create a basic unarchive playbook that grabs a tar.gz file and excludes various directories:
- name: download and extract a tar
  unarchive:
      src: http://releases.ansible.com/ansible-tower/setup/ansible-tower-setup-2.4.5.tar.gz
      dest: /tmp
      copy: no
      exclude: httpd,iptables,misc,supervisor,restore

EXPECTED RESULTS

All five of those directories are not included in the unarchive operation

ACTUAL RESULTS
fatal: [52.41.174.245]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"backup": null, "content": null, "copy": false, "creates": null, "delimiter": null, "dest": "/tmp", "directory_mode": null, "exclude": ["httpd", "iptables", "misc", "supervisor", "restore"], "extra_opts": [], "follow": false, "force": null, "group": null, "keep_newer": false, "list_files": false, "mode": null, "original_basename": "ansible-tower-setup-2.4.5.tar.gz", "owner": null, "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "http://releases.ansible.com/ansible-tower/setup/ansible-tower-setup-2.4.5.tar.gz"}}, "msg": "path /tmp/ansible-tower-setup-2.4.5/roles/httpd does not exist", "path": "/tmp/ansible-tower-setup-2.4.5/roles/httpd", "state": "absent"}

The directory that fails is also arbitrary. If I take out httpd from my exclude list, another directory will fail with the same error.

@dagwieers
Copy link
Contributor

A recent change (#3575) has broken the --exclude functionality by implementing a pure-python files_in_archive implementation which is incompatible with gtar's pattern matching. @abadger Can we please undo this broken PR #3575 ? See: #3575 (comment)

@michelleperz Please use a YAML list, not comma-seperated entries, something like:

  exclude:
  - path/to/file
  - path/to/dir/

We should probably improve the documentation to make this clear.

@michelleperz
Copy link
Author

@dagwieers does this also break the extra_opts param? Getting a similar error when I add in extra_opts: --strip-components=1?

@dagwieers
Copy link
Contributor

@michelleperz Yes.

@abadger
Copy link
Contributor

abadger commented Jul 6, 2016

This should now be fixed. Going ahead and closing it.

@abadger abadger closed this as completed Jul 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants