-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add force_archive option to archive module to allow archiving and compression of single files #49429
Conversation
Hi @markafarrell, thank you for submitting this pull-request! |
@bendoh I noticed a closed issue #33563, that mentions that the intended behavior of the archive module when passed a single file is to only compress the file (not archive it). Would you consider the above as a possible solution to this. It maintains the current behavior of the module, while allowing the user to choose to create an archive of a single file if that is what they want. I believe this is a good half-way house and adds needed functionality without breaking backwards compatibility. |
I like it! shipit |
close and re-open to re-run ci |
@bendoh Do I need to do anything else to get this merged? |
@markafarrell this PR contains the following merge commits: Please rebase your branch to remove these commits. |
shipit |
@bendoh It looks like there is no entry in https://github.com/ansible/ansible/blob/devel/.github/BOTMETA.yml for this module (which I think is why ansibot is not adding the shipit label and hence it not being merged) Any idea how to get that fixed? |
Other than just adding myself, I do not. Can that be done as part of this PR? |
@bendoh as the module author, you are automatically considered the maintainer so you don't need to be added to BOTMETA.yml rebuild_merge |
@markafarrell because it takes more than one shipit to put a pullrequest into a shipit state. |
SUMMARY
This PR enables a user to force the archive module to create an archive when working with a single file. (Rather than just compressing the file)
NOTE: This is not applicable to zip files as the default behaviour for zipping a single file is to archive already.
NOTE: This PR does not change the default behaviour of the module.
ISSUE TYPE
COMPONENT NAME
lib/ansible/modules/files/archive.py
ADDITIONAL INFORMATION
Before PR
ansible localhost -m archive -a "dest=test.tar.gz path=test.file"
No files are listed as the tar archive was not created the file was only compressed using gzip.
cat test.tar.gz | gunzip
Output:
Contents of file is shown after being decompressed as the tar archive was not created the file was only compressed using gzip.
After PR:
ansible localhost -m archive -a "dest=test.tar.gz path=test.file force_archive=true"
Output:
test.file
is correctly listed