當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。