Assaf Muller has uploaded a new change for review. Change subject: Added lib/vdsm/utils.py:touchFile ......................................................................
Added lib/vdsm/utils.py:touchFile Change-Id: Ifbbea57c425adc8b911bb9e1931c02edb71db820 Signed-off-by: Assaf Muller <[email protected]> --- M lib/vdsm/utils.py 1 file changed, 14 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/21590/1 diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py index 3166a92..cd0f24c 100644 --- a/lib/vdsm/utils.py +++ b/lib/vdsm/utils.py @@ -103,6 +103,20 @@ return stat.S_ISBLK(os.stat(path).st_mode) +def touchFile(filePath, ignoreExceptions=False): + """ + Subset of POSIX touch functionality + :param filePath: The file to touch + :param ignoreExceptions: Should file handling exceptions be ignored? + """ + try: + with open(filePath, 'a'): + os.utime(filePath, None) + except (IOError, OSError) as e: + if not ignoreExceptions: + raise e + + def rmFile(fileToRemove): """ Try to remove a file. -- To view, visit http://gerrit.ovirt.org/21590 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifbbea57c425adc8b911bb9e1931c02edb71db820 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Assaf Muller <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
