diff --git a/trove/guestagent/volume.py b/trove/guestagent/volume.py index 02837166a0..3258b77ce3 100644 --- a/trove/guestagent/volume.py +++ b/trove/guestagent/volume.py @@ -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, diff --git a/trove/tests/unittests/guestagent/test_volume.py b/trove/tests/unittests/guestagent/test_volume.py index 62dd8e1b1c..daa84e9010 100644 --- a/trove/tests/unittests/guestagent/test_volume.py +++ b/trove/tests/unittests/guestagent/test_volume.py @@ -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_