-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Allow to users to touch file with Unix date of birth #49310
Conversation
Change file.touch management to allow user to specify atime or mtime values of '0' to touch file with Unix epoch time 1970-01-01 01:00:00.000000000. Only positive value for atime and mtime was allowed.
If we're going to do something like this, I don't think it should be an undocumented side-effect of setting the value to |
@cachedout Do you think people who need to touch the file with current date has configured their states with atime="0" and mtime="0" and this PR would brings side effects ? Leaving these options unset is a shorter way to get this result. But if this PR is allowed, indeed a documentation update should be required too, I agree. But I don't think on the other side that a new keyword would be required. This is my first Salt PR so I don't really have the required experience back regarding side effects ^^ Let's discuss it :) |
@importepeu No, that's not quite what I mean. I just mean that if setting it to |
Ok, fine. Am I able to update the doc ? I saw that jenkins jobs for centos7 failed for python2 and python3, does this mean that I need to investigate the error on thoose plateforms ? The code was tested on Ubuntu 16 with python2 and as far as I see, thoose errors don't seem to be directly linked to the updated code...
Regards, |
It just needs to be documented in the docstring for the function itself. There is no need to worry about those other errors. They are unrelated to your change. |
Add some documentation about possible values, particularly what time will be used when setting atime or mtime to 0 or when unset them.
@cachedout Hi, I've updated the file with some documentation as requested. Please let me know if it's ok. Regards, Guillaume. |
What does this PR do?
Change file.touch management to allow users to specify atime or mtime values of '0' to touch file with Unix epoch time 1970-01-01 01:00:00.000000000.
What issues does this PR fix or reference?
None
Previous Behavior
Setting atime or mtime with "0" touched the file with current timestamp instead of Unix date of birth.
New Behavior
Now users can set atime or mtime values to '0' to get Unix date of birth, set them to other positive values or unset them to touch file with current time.
Tests written?
No but I've tested the code like this :
Commits signed with GPG?
No
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.