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


Python host.service_start方法代码示例

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


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

示例1: update_status

# 需要导入模块: from charmhelpers.core import host [as 别名]
# 或者: from charmhelpers.core.host import service_start [as 别名]
def update_status():
    """Use the update-status hook to check to see if we can restart the
    manila-share service: (BUG#1706699).  The bug appears to be a race-hazard
    but it's proving very difficult to track it down.

    This is a band-aid to enable the charm to get into a working state once all
    of the interfaces have joined, and the bug has been hit; otherwise the
    charm stays "stuck" with the service not running.

    Note, there is no need to actually call update_status as one of the other
    handlers will activate it.
    """
    if not os_utils.is_unit_paused_set():
        state, message = os_utils._ows_check_services_running(
            services=['manila-share'],
            ports=None)
        if state == 'blocked':
            # try to start the 'manila-share' service
            ch_host.service_start('manila-share') 
开发者ID:openstack,项目名称:charm-manila,代码行数:21,代码来源:manila_handlers.py

示例2: restart_on_change

# 需要导入模块: from charmhelpers.core import host [as 别名]
# 或者: from charmhelpers.core.host import service_start [as 别名]
def restart_on_change(self):
        """Restart the services in the self.restart_map{} attribute if any of
        the files identified by the keys changes for the wrapped call.

        This function is a @decorator that checks if the wrapped function
        changes any of the files identified by the keys in the
        self.restart_map{} and, if they change, restarts the services in the
        corresponding list.
        """
        checksums = {path: ch_host.path_hash(path)
                     for path in self.full_restart_map.keys()}
        yield
        restarts = []
        for path in self.full_restart_map:
            if ch_host.path_hash(path) != checksums[path]:
                restarts += self.full_restart_map[path]
        services_list = list(collections.OrderedDict.fromkeys(restarts).keys())
        for service_name in services_list:
            ch_host.service_stop(service_name)
        for service_name in services_list:
            ch_host.service_start(service_name) 
开发者ID:openstack,项目名称:charms.openstack,代码行数:23,代码来源:core.py

示例3: service_restart

# 需要导入模块: from charmhelpers.core import host [as 别名]
# 或者: from charmhelpers.core.host import service_start [as 别名]
def service_restart(service_name):
    """
    Wrapper around host.service_restart to prevent spurious "unknown service"
    messages in the logs.
    """
    if host.service_available(service_name):
        if host.service_running(service_name):
            host.service_restart(service_name)
        else:
            host.service_start(service_name)


# Convenience aliases 
开发者ID:openstack,项目名称:charm-plumgrid-gateway,代码行数:15,代码来源:base.py

示例4: restart_prometheus

# 需要导入模块: from charmhelpers.core import host [as 别名]
# 或者: from charmhelpers.core.host import service_start [as 别名]
def restart_prometheus():
    if not host.service_running(SVCNAME):
        hookenv.log('Starting {}...'.format(SVCNAME))
        host.service_start(SVCNAME)
    else:
        hookenv.log('Restarting {}, config file changed...'.format(SVCNAME))
        host.service_restart(SVCNAME)
    hookenv.status_set('active', 'Ready')
    set_state('prometheus.started')
    remove_state('prometheus.do-restart')


# Relations 
开发者ID:tasdomas,项目名称:juju-charm-prometheus,代码行数:15,代码来源:prometheus.py


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