Changes command to create the directory
Reasons: - os.makedirs since running under normal user access will not be able to create the directory at root locations like /var/lib. Changes: - Used utils.execute like used at other places for working under root access. - Test changed to test utils.execute instead of os.makedirs Change-Id: Ie2313ae4cc22ac4a9baa4d8e099080f227a980c4 Closes-Bug: #1261492
This commit is contained in:
parent
59a778b857
commit
8b5ce44b1b
@ -132,7 +132,7 @@ class VolumeMountPoint(object):
|
||||
|
||||
def mount(self):
|
||||
if not os.path.exists(self.mount_point):
|
||||
os.makedirs(self.mount_point)
|
||||
utils.execute("sudo", "mkdir", "-p", self.mount_point)
|
||||
LOG.debug("Adding volume. Device path:%s, mount_point:%s, "
|
||||
"volume_type:%s, mount options:%s" %
|
||||
(self.device_path, self.mount_point, self.volume_fstype,
|
||||
|
@ -161,12 +161,12 @@ class VolumeMountPointTest(testtools.TestCase):
|
||||
os.path.exists = MagicMock(return_value=False)
|
||||
fake_spawn = _setUp_fake_spawn()
|
||||
|
||||
os.makedirs = MagicMock()
|
||||
utils.execute = Mock()
|
||||
|
||||
self.volumeMountPoint.mount()
|
||||
|
||||
self.assertEqual(1, os.path.exists.call_count)
|
||||
self.assertEqual(1, os.makedirs.call_count)
|
||||
self.assertEqual(1, utils.execute.call_count)
|
||||
self.assertEqual(1, fake_spawn.expect.call_count)
|
||||
|
||||
os.path.exists = origin_
|
||||
|
Loading…
x
Reference in New Issue
Block a user