Move ensure_tree to utils
Its useful to people other that virt drivers. Change-Id: I721094a1785d7a275f4bfa8994b7b114a6ec07f6
This commit is contained in:
@@ -63,10 +63,6 @@ def remove_logical_volumes(*paths):
|
||||
pass
|
||||
|
||||
|
||||
def ensure_tree(path):
|
||||
pass
|
||||
|
||||
|
||||
def write_to_file(path, contents, umask=None):
|
||||
pass
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ class _ImageTestCase(test.TestCase):
|
||||
os.path.exists(self.TEMPLATE_PATH).AndReturn(False)
|
||||
fn = self.mox.CreateMockAnything()
|
||||
fn(target=self.TEMPLATE_PATH)
|
||||
self.mox.StubOutWithMock(imagebackend.libvirt_utils, 'ensure_tree')
|
||||
imagebackend.libvirt_utils.ensure_tree(self.TEMPLATE_DIR)
|
||||
self.mox.StubOutWithMock(imagebackend.utils, 'ensure_tree')
|
||||
imagebackend.utils.ensure_tree(self.TEMPLATE_DIR)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
image = self.image_class(self.INSTANCE, self.NAME)
|
||||
@@ -82,7 +82,7 @@ class _ImageTestCase(test.TestCase):
|
||||
os.path.exists(self.TEMPLATE_PATH).AndReturn(False)
|
||||
fn = self.mox.CreateMockAnything()
|
||||
fn(target=self.TEMPLATE_PATH)
|
||||
self.mox.StubOutWithMock(imagebackend.libvirt_utils, 'ensure_tree')
|
||||
self.mox.StubOutWithMock(imagebackend.utils, 'ensure_tree')
|
||||
self.mox.ReplayAll()
|
||||
|
||||
image = self.image_class(self.INSTANCE, self.NAME)
|
||||
|
||||
@@ -3394,12 +3394,6 @@ disk size: 4.4M''', ''))
|
||||
libvirt_utils.mkfs('ext4', '/my/block/dev')
|
||||
libvirt_utils.mkfs('swap', '/my/swap/block/dev')
|
||||
|
||||
def test_ensure_tree(self):
|
||||
with utils.tempdir() as tmpdir:
|
||||
testdir = '%s/foo/bar/baz' % (tmpdir,)
|
||||
libvirt_utils.ensure_tree(testdir)
|
||||
self.assertTrue(os.path.isdir(testdir))
|
||||
|
||||
def test_write_to_file(self):
|
||||
dst_fd, dst_path = tempfile.mkstemp()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user