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
template, copy: support for archive, atime, mtime parameters #27965
Conversation
I canceled the CI run as we're experiencing a significant backlog right now and multiple errors were already being reported for this PR. Most of the failures are probably due to this syntax error:
|
The test
The test
The test
The test
The test
The test
|
Compatibility with Python 3+ and pep8 tests has been fixed, the CI run / verification process can be resumed. |
@rdolejsi, if you wish to rerun the CI tests, you can just close and re-open the PR. All the history is preserved so nothing is lost by doing this. |
i forced CI rerun |
CI failure in unit tests:
|
@rdolejsi this PR contains the following merge commits: Please rebase your branch to remove these commits. |
Hi @rdolejsi , sorry for taking so long in getting back to review this, but overall the functionality looks good. Are you still interested in pursuing this PR? If so, we can work on getting it merged if you rebase it. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was rebasing this locally to add some tests and review, and wondered if we should keep the interface for this more similar to the file module. In 2.7 the file module added options to preserve atime/mtime. The access_time/modification_time options can be set to 'preserve' or 'now' and the date format is configurable for both rather than hardcoded. We could move a couple of those functions (get_timestamp_for_time
, and update_timestamp_for_file
) to common code to have less duplication.
Also, I'm not sure about the need for the blanket 'archive' option. The copy module already has an option to preserve 'mode', and owner and group seem straightforward. Perhaps we should add individual options to preserve timestamps first, and add the all-encompassing option in a follow-up PR if it seems very helpful. That option should also be mutually exclusive with the finer-grain options, since they are just ignored at the moment.
Having just made a near-duplicate feature request #74655 (but without pull, Python's not my thing), could I also suggest/request similar functionality in fetch? |
@jrowens A comment was left on the feature request to make sure fetch is not forgotten #55768 (comment). In my opinion, this probably needs to be implemented from scratch to keep the interface similar to the |
waiting_on_contributor |
Thank you very much for your submission to Ansible. It means a lot to us that you've taken time to contribute. Unfortunately, this issue has been open for some time while waiting for a contributor to take it up but there does not seem to have been anyone that did so. So we are going to close this issue to clear up the queues and make it easier for contributors to browse possible implementation targets. However, we're absolutely always up for discussion. Because this project is very active, we're unlikely to see comments made on closed tickets and we lock them after some time. If you or anyone else has any further questions, please let us know by using any of the communication methods listed in the page below: In the future, sometimes starting a discussion on the development list prior to proposing or implementing a feature can make getting things included a little easier, but it's not always necessary. Thank you once again for this and your interest in Ansible! |
SUMMARY
template, copy: added support for new parameter 'archive' to allow retaining ownership and timestamps of the source(s) to allow creation of (templated) file with exact permissions on destination.
template, copy, file: added support for new parameters mtime, atime to allow setting access/mod datetime in unix touch format HHMMDDhhmi[.ss]. This is a feature required by the aforementioned template, copy 'archive' feature and cannot be split in separate pull request.
This is a third port of original pull request(s) not integrated in time:
for Ansible <1.7: #9143
for Ansible 1.7+ (multi-module): #9233, ansible/ansible-modules-core#102
ISSUE TYPE
COMPONENT NAME
file, copy, template
ANSIBLE VERSION
ADDITIONAL INFORMATION
Commands template, copy support new parameter archive=True/False (default). When set to true, the created file retains permissions and ownership of the source template file. This allows seamless creation of templated scripts on the remote host.
Commands template, copy support new parameters atime=, mtime= allowing for creation of exactly-dated files on the destination host. This is useful for environments sensitive to file datetime changes.