def restart_gobinary(): remove_state("gobinary.start") bin_config = gobinary.config() if host.service_running(bin_config["binary"]): host.service_restart(bin_config["binary"]) else: host.service_start(bin_config["binary"]) set_state("gobinary.started")
def upgrade(): # TODO: get_state("go-binary.config") # and compare with upgraded, remove old service if name has changed. config = gobinary.config() service = config["binary"] need_restart = False if host.service_running(service): need_restart = True host.service_stop(service) install_workload(config) if need_restart: host.service_start(service)
def upgrade(): # TODO: get_state("go-binary.config") # and compare with upgraded, remove old service if name has changed. config = gobinary.config() service = config["binary"] need_restart = False if host.service_running(service): need_restart = True if need_restart: host.service_stop(service) install_workload(config) if need_restart: host.service_start(service)
def setup(db, _): bin_config = gobinary.config() remove_state('gobinary.start') if is_state('gobinary.started'): host.service_stop(bin_config['binary']) config = hookenv.config() render(source="config.yaml", target="/etc/myserver/config.yaml", owner="root", perms=0o644, context={ 'cfg': config, 'db': db, }) set_state('gobinary.start') if is_state('gobinary.started'): host.service_start(bin_config['binary']) else: hookenv.status_set('maintenance', 'Starting server')
def stop_gobinary(): remove_state("gobinary.stop") bin_config = gobinary.config() if host.service_running(bin_config["binary"]): host.service_stop(bin_config["binary"])
def install(): config = gobinary.config() install_workload(config)
def stop_gobinary(): bin_config = gobinary.config() host.service_stop(bin_config['binary']) remove_state('gobinary.started')
def start_gobinary(): bin_config = gobinary.config() host.service_start(bin_config['binary']) set_state('gobinary.started')
def install(): config = gobinary.config() install_workload(config) set_state('gobinary.start')