def unmount_volume(config):
if os.path.ismount(config['mountpoint']):
if not host.umount(config['mountpoint'], persist=True):
raise VolumeConfigurationError()
python类umount()的实例源码
def unmount_volume(config):
if os.path.ismount(config['mountpoint']):
if not host.umount(config['mountpoint'], persist=True):
raise VolumeConfigurationError()
def unmount_volume(config):
if os.path.ismount(config['mountpoint']):
if not host.umount(config['mountpoint'], persist=True):
raise VolumeConfigurationError()
def unmount_volume(config):
if os.path.ismount(config['mountpoint']):
if not host.umount(config['mountpoint'], persist=True):
raise VolumeConfigurationError()
def unmount_volume(config):
if os.path.ismount(config['mountpoint']):
if not host.umount(config['mountpoint'], persist=True):
raise VolumeConfigurationError()
def unmount_volume(config):
if os.path.ismount(config['mountpoint']):
if not host.umount(config['mountpoint'], persist=True):
raise VolumeConfigurationError()
def unmount_volume(config):
if os.path.ismount(config['mountpoint']):
if not host.umount(config['mountpoint'], persist=True):
raise VolumeConfigurationError()
def unmount_volume(config):
if os.path.ismount(config['mountpoint']):
if not host.umount(config['mountpoint'], persist=True):
raise VolumeConfigurationError()
def test_umounts_a_device(self, log, check_output, fstab):
mountpoint = '/mnt/guido'
result = host.umount(mountpoint, persist=True)
self.assertTrue(result)
check_output.assert_called_with(['umount', mountpoint])
fstab.remove_by_mountpoint_called_with(mountpoint)
def test_umounts_and_persist_device(self, log, check_output):
mountpoint = '/mnt/guido'
result = host.umount(mountpoint)
self.assertTrue(result)
check_output.assert_called_with(['umount', '/mnt/guido'])
def test_doesnt_umount_on_error(self, log, check_output):
mountpoint = '/mnt/guido'
error = subprocess.CalledProcessError(123, 'mount it', 'Oops...')
check_output.side_effect = error
result = host.umount(mountpoint)
self.assertFalse(result)
check_output.assert_called_with(['umount', '/mnt/guido'])
def unmount_volume(config):
if os.path.ismount(config['mountpoint']):
if not host.umount(config['mountpoint'], persist=True):
raise VolumeConfigurationError()