read_metadata() consumers should catch IOError

The xattr module raises IOError which is what the call to
read_metadata() in rmobjdir() should be catching.

Change-Id: I2983ad0be453647f80b862eea93a5fc16fcef04a
Signed-off-by: Prashanth Pai <ppai@redhat.com>
This commit is contained in:
Prashanth Pai 2015-07-09 12:23:43 +05:30
parent d792d40bd7
commit 18d039a893
3 changed files with 7 additions and 6 deletions

View File

@ -311,7 +311,7 @@ def rmobjdir(dir_path):
try:
metadata = read_metadata(fullpath)
except OSError as err:
except IOError as err:
if err.errno == errno.ENOENT:
# Ignore removal from another entity.
continue

View File

@ -27,7 +27,8 @@ import shutil
from collections import defaultdict
from mock import patch
from swiftonfile.swift.common import utils
from swiftonfile.swift.common.exceptions import SwiftOnFileSystemOSError
from swiftonfile.swift.common.exceptions import SwiftOnFileSystemOSError, \
SwiftOnFileSystemIOError
from swift.common.exceptions import DiskFileNoSpace
#
@ -579,7 +580,8 @@ class TestUtilsDirObjects(unittest.TestCase):
def _mock_rm(path):
print "_mock_rm-metadata_enoent(%s)" % path
shutil.rmtree(path)
raise OSError(errno.ENOENT, os.strerror(errno.ENOENT))
raise SwiftOnFileSystemIOError(errno.ENOENT,
os.strerror(errno.ENOENT))
# Remove the files
for f in self.files:
@ -590,8 +592,8 @@ class TestUtilsDirObjects(unittest.TestCase):
try:
try:
self.assertTrue(utils.rmobjdir(self.rootdir))
except OSError:
self.fail("Unexpected OSError")
except IOError:
self.fail("Unexpected IOError")
else:
pass
finally:

View File

@ -35,7 +35,6 @@ setenv = VIRTUAL_ENV={envdir}
NOSE_COVER_HTML_DIR={toxinidir}/cover
[tox:jenkins]
# Commented as workaround for PyECLib issue
downloadcache = ~/cache/pip
# To be used by Jenkins