mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Port #49310 to master
This commit is contained in:
parent
1736155ccb
commit
a4661b2002
1 changed files with 9 additions and 5 deletions
|
@ -3525,9 +3525,13 @@ def touch(name, atime=None, mtime=None):
|
|||
simply update the atime and mtime if it already does.
|
||||
|
||||
atime:
|
||||
Access time in Unix epoch time
|
||||
Access time in Unix epoch time. Set it to 0 to set atime of the
|
||||
file with Unix date of birth. If this parameter isn't set, atime
|
||||
will be set with current time.
|
||||
mtime:
|
||||
Last modification in Unix epoch time
|
||||
Last modification in Unix epoch time. Set it to 0 to set mtime of
|
||||
the file with Unix date of birth. If this parameter isn't set,
|
||||
mtime will be set with current time.
|
||||
|
||||
CLI Example:
|
||||
|
||||
|
@ -3546,11 +3550,11 @@ def touch(name, atime=None, mtime=None):
|
|||
with salt.utils.files.fopen(name, "a"):
|
||||
pass
|
||||
|
||||
if not atime and not mtime:
|
||||
if atime is None and mtime is None:
|
||||
times = None
|
||||
elif not mtime and atime:
|
||||
elif mtime is None and atime is not None:
|
||||
times = (atime, time.time())
|
||||
elif not atime and mtime:
|
||||
elif atime is None and mtime is not None:
|
||||
times = (time.time(), mtime)
|
||||
else:
|
||||
times = (atime, mtime)
|
||||
|
|
Loading…
Add table
Reference in a new issue