Fix traceback in image cache manager.
When nova is running as a different user, the image cache manager can cause tracebacks because it is not able to access the file. This fixes bug: 973377 Change-Id: I7902b024e7d564fbda97ce8532c1de84ab1a4206 Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
committed by
Vishvananda Ishaya
parent
5117dd13a4
commit
2239a2d288
@@ -436,6 +436,7 @@ class ImageCacheManagerTestCase(test.TestCase):
|
|||||||
self.assertEquals(image_cache_manager.corrupt_base_files, [])
|
self.assertEquals(image_cache_manager.corrupt_base_files, [])
|
||||||
|
|
||||||
def test_handle_base_image_used(self):
|
def test_handle_base_image_used(self):
|
||||||
|
self.stubs.Set(virtutils, 'chown', lambda x, y: None)
|
||||||
img = '123'
|
img = '123'
|
||||||
|
|
||||||
with self._make_base_file() as fname:
|
with self._make_base_file() as fname:
|
||||||
@@ -496,6 +497,8 @@ class ImageCacheManagerTestCase(test.TestCase):
|
|||||||
self.assertEquals(image_cache_manager.corrupt_base_files, [])
|
self.assertEquals(image_cache_manager.corrupt_base_files, [])
|
||||||
|
|
||||||
def test_handle_base_image_checksum_fails(self):
|
def test_handle_base_image_checksum_fails(self):
|
||||||
|
self.stubs.Set(virtutils, 'chown', lambda x, y: None)
|
||||||
|
|
||||||
img = '123'
|
img = '123'
|
||||||
|
|
||||||
with self._make_base_file() as fname:
|
with self._make_base_file() as fname:
|
||||||
@@ -563,6 +566,8 @@ class ImageCacheManagerTestCase(test.TestCase):
|
|||||||
|
|
||||||
self.stubs.Set(os.path, 'exists', lambda x: exists(x))
|
self.stubs.Set(os.path, 'exists', lambda x: exists(x))
|
||||||
|
|
||||||
|
self.stubs.Set(virtutils, 'chown', lambda x, y: None)
|
||||||
|
|
||||||
# We need to stub utime as well
|
# We need to stub utime as well
|
||||||
orig_utime = os.utime
|
orig_utime = os.utime
|
||||||
self.stubs.Set(os, 'utime', lambda x, y: None)
|
self.stubs.Set(os, 'utime', lambda x, y: None)
|
||||||
|
|||||||
Reference in New Issue
Block a user