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


Python unitdata.HookData方法代码示例

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


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

示例1: resume

# 需要导入模块: from charmhelpers.core import unitdata [as 别名]
# 或者: from charmhelpers.core.unitdata import HookData [as 别名]
def resume(args):
    """Resume all the swift services.

    @raises Exception if any services fail to start
    """
    for service in args.services:
        started = service_resume(service)
        if not started:
            raise Exception("{} didn't start cleanly.".format(service))
    with HookData()():
        kv().set('unit-paused', False)
    set_os_workload_status(CONFIGS, REQUIRED_INTERFACES,
                           charm_func=assess_status)


# A dictionary of all the defined actions to callables (which take
# parsed arguments). 
开发者ID:openstack,项目名称:charm-swift-storage,代码行数:19,代码来源:actions.py

示例2: config_value_changed

# 需要导入模块: from charmhelpers.core import unitdata [as 别名]
# 或者: from charmhelpers.core.unitdata import HookData [as 别名]
def config_value_changed(option):
    """
    Determine if config value changed since last call to this function.
    """
    hook_data = unitdata.HookData()
    with hook_data():
        db = unitdata.kv()
        current = config(option)
        saved = db.get(option)
        db.set(option, current)
        if saved is None:
            return False
        return current != saved 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:15,代码来源:utils.py

示例3: set_unit_paused

# 需要导入模块: from charmhelpers.core import unitdata [as 别名]
# 或者: from charmhelpers.core.unitdata import HookData [as 别名]
def set_unit_paused():
    """Set the unit to a paused state in the local kv() store.
    This does NOT actually pause the unit
    """
    with unitdata.HookData()() as t:
        kv = t[0]
        kv.set('unit-paused', True) 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:9,代码来源:utils.py

示例4: clear_unit_paused

# 需要导入模块: from charmhelpers.core import unitdata [as 别名]
# 或者: from charmhelpers.core.unitdata import HookData [as 别名]
def clear_unit_paused():
    """Clear the unit from a paused state in the local kv() store
    This does NOT actually restart any services - it only clears the
    local state.
    """
    with unitdata.HookData()() as t:
        kv = t[0]
        kv.set('unit-paused', False) 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:10,代码来源:utils.py

示例5: is_unit_paused_set

# 需要导入模块: from charmhelpers.core import unitdata [as 别名]
# 或者: from charmhelpers.core.unitdata import HookData [as 别名]
def is_unit_paused_set():
    """Return the state of the kv().get('unit-paused').
    This does NOT verify that the unit really is paused.

    To help with units that don't have HookData() (testing)
    if it excepts, return False
    """
    try:
        with unitdata.HookData()() as t:
            kv = t[0]
            # transform something truth-y into a Boolean.
            return not(not(kv.get('unit-paused')))
    except Exception:
        return False 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:16,代码来源:utils.py

示例6: is_unit_paused_set

# 需要导入模块: from charmhelpers.core import unitdata [as 别名]
# 或者: from charmhelpers.core.unitdata import HookData [as 别名]
def is_unit_paused_set():
    """Return the state of the kv().get('unit-paused').
    This does NOT verify that the unit really is paused.

    To help with units that don't have HookData() (testing)
    if it excepts, return False
    """
    try:
        with unitdata.HookData()() as t:
            kv = t[0]
            # transform something truth-y into a Boolean.
            return not(not(kv.get('unit-paused')))
    except:
        return False 
开发者ID:openstack,项目名称:charm-ceph-osd,代码行数:16,代码来源:utils.py


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