Yeela Kaplan has uploaded a new change for review. Change subject: fix error handling in isdir and islink ......................................................................
fix error handling in isdir and islink isdir and islink implemented using ioprocess will throw an exception in case of stat failure because of errno ENOENT, while it should return False. Change-Id: Iaa7d1a16ba2940963d29a19a7140235fbd80ba8d Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1115123 Signed-off-by: Yeela Kaplan <[email protected]> --- M vdsm/storage/outOfProcess.py 1 file changed, 18 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/29633/1 diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py index 9003f40..b4745dc 100644 --- a/vdsm/storage/outOfProcess.py +++ b/vdsm/storage/outOfProcess.py @@ -248,12 +248,26 @@ self._iop = iop def isdir(self, path): - res = self._iop.stat(path) - return stat.S_ISDIR(res.st_mode) + try: + res = self._iop.stat(path) + except OSError as e: + if e.errno == errno.ENOENT: + return False + else: + raise e + else: + return stat.S_ISDIR(res.st_mode) def islink(self, path): - res = self._iop.stat(path) - return stat.S_ISLNK(res.st_mode) + try: + res = self._iop.stat(path) + except OSError as e: + if e.errno == errno.ENOENT: + return False + else: + raise e + else: + return stat.S_ISLNK(res.st_mode) def lexists(self, path): return self._iop.lexists(path) -- To view, visit http://gerrit.ovirt.org/29633 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaa7d1a16ba2940963d29a19a7140235fbd80ba8d Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
