当前位置: 首页>>代码示例>>Python>>正文


Python host.umount方法代码示例

本文整理汇总了Python中charmhelpers.core.host.umount方法的典型用法代码示例。如果您正苦于以下问题:Python host.umount方法的具体用法?Python host.umount怎么用?Python host.umount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在charmhelpers.core.host的用法示例。


在下文中一共展示了host.umount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ephemeral_unmount

# 需要导入模块: from charmhelpers.core import host [as 别名]
# 或者: from charmhelpers.core.host import umount [as 别名]
def ephemeral_unmount() -> Result:
    """
    Unmount amazon ephemeral mount points.
    :return: Result with Ok or Err depending on the outcome of unmount.
    """
    mountpoint = config("ephemeral_unmount")
    if mountpoint is None:
        return Ok(())
    # Remove the entry from the fstab if it's set
    fstab = FsTab(os.path.join(os.sep, "etc", "fstab"))
    log("Removing ephemeral mount from fstab")
    fstab.remove_entry_by_mountpoint(mountpoint)

    if filesystem_mounted(mountpoint):
        result = umount(mountpoint=mountpoint)
        if not result:
            return Err("unmount of {} failed".format(mountpoint))
        # Unmounted Ok
        log("{} unmounted".format(mountpoint))
        return Ok(())
    # Not mounted
    return Ok(()) 
开发者ID:openstack,项目名称:charm-glusterfs,代码行数:24,代码来源:lib.py

示例2: unmount_volume

# 需要导入模块: from charmhelpers.core import host [as 别名]
# 或者: from charmhelpers.core.host import umount [as 别名]
def unmount_volume(config):
    if os.path.ismount(config['mountpoint']):
        if not host.umount(config['mountpoint'], persist=True):
            raise VolumeConfigurationError() 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:6,代码来源:volumes.py

示例3: test_umounts_a_device

# 需要导入模块: from charmhelpers.core import host [as 别名]
# 或者: from charmhelpers.core.host import umount [as 别名]
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) 
开发者ID:juju,项目名称:charm-helpers,代码行数:10,代码来源:test_host.py

示例4: test_umounts_and_persist_device

# 需要导入模块: from charmhelpers.core import host [as 别名]
# 或者: from charmhelpers.core.host import umount [as 别名]
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']) 
开发者ID:juju,项目名称:charm-helpers,代码行数:9,代码来源:test_host.py

示例5: test_doesnt_umount_on_error

# 需要导入模块: from charmhelpers.core import host [as 别名]
# 或者: from charmhelpers.core.host import umount [as 别名]
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']) 
开发者ID:juju,项目名称:charm-helpers,代码行数:12,代码来源:test_host.py


注:本文中的charmhelpers.core.host.umount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。