Skip to content
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

Merged
merged 2 commits into from
Mar 20, 2019

Conversation

markafarrell
Copy link
Contributor

@markafarrell markafarrell commented Dec 3, 2018

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
  • Feature Pull Request
COMPONENT NAME

lib/ansible/modules/files/archive.py

ADDITIONAL INFORMATION

Before PR

  1. Create a file to be archived
echo asdf > test.file
  1. Archive the file
ansible localhost -m archive -a "dest=test.tar.gz path=test.file"
  1. List the files in the archive
tar --list -f test.tar.gz

No files are listed as the tar archive was not created the file was only compressed using gzip.

  1. Decompress file using gunzip
cat test.tar.gz | gunzip

Output:

asdf

Contents of file is shown after being decompressed as the tar archive was not created the file was only compressed using gzip.

After PR:

  1. Create a file to be archived
echo asdf > test.file
  1. Archive the file
ansible localhost -m archive -a "dest=test.tar.gz path=test.file force_archive=true"
  1. List the files in the archive
tar --list -f test.tar.gz

Output:

test.file

test.file is correctly listed

@ansibot
Copy link
Contributor

ansibot commented Dec 3, 2018

Hi @markafarrell, thank you for submitting this pull-request!

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 community_review In order to be merged, this PR must follow the community review workflow. feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. labels Dec 3, 2018
@markafarrell
Copy link
Contributor Author

@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.

@bendoh
Copy link
Contributor

bendoh commented Dec 11, 2018

I like it!

shipit

@ansibot ansibot added stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. and removed needs_triage Needs a first human triage before being processed. labels Dec 11, 2018
@markafarrell
Copy link
Contributor Author

close and re-open to re-run ci

@markafarrell markafarrell reopened this Dec 11, 2018
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 11, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 22, 2018
@markafarrell
Copy link
Contributor Author

@bendoh Do I need to do anything else to get this merged?

@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jan 23, 2019
@ansibot
Copy link
Contributor

ansibot commented Jan 29, 2019

@markafarrell this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot ansibot added merge_commit This PR contains at least one merge commit. Please resolve! needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jan 29, 2019
@ansibot ansibot removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Jan 29, 2019
@ansibot ansibot added the community_review In order to be merged, this PR must follow the community review workflow. label Jan 29, 2019
@bendoh
Copy link
Contributor

bendoh commented Jan 29, 2019

shipit

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Feb 6, 2019
@ansibot ansibot added the files Files category label Mar 4, 2019
@markafarrell
Copy link
Contributor Author

@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?

@bendoh
Copy link
Contributor

bendoh commented Mar 8, 2019

Other than just adding myself, I do not. Can that be done as part of this PR?

@jctanner
Copy link
Contributor

@bendoh as the module author, you are automatically considered the maintainer so you don't need to be added to BOTMETA.yml

rebuild_merge

@ansibot ansibot added shipit This PR is ready to be merged by Core and removed community_review In order to be merged, this PR must follow the community review workflow. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Mar 20, 2019
@jctanner jctanner merged commit 3b87681 into ansible:devel Mar 20, 2019
@markafarrell
Copy link
Contributor Author

@jctanner Why didn't @bendoh saying shipit cause ansibot to add the shipit tag then?

@jctanner
Copy link
Contributor

@markafarrell because it takes more than one shipit to put a pullrequest into a shipit state.

https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md#when-will-your-pull-request-be-merged

@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 feature This issue/PR relates to a feature request. files Files category module This issue/PR relates to a module. shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants