我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用charmhelpers.core.host.service_available()。
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