Ejemplo n.º 1
0
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")
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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')
Ejemplo n.º 5
0
def stop_gobinary():
    remove_state("gobinary.stop")
    bin_config = gobinary.config()
    if host.service_running(bin_config["binary"]):
        host.service_stop(bin_config["binary"])
Ejemplo n.º 6
0
def install():
    config = gobinary.config()
    install_workload(config)
Ejemplo n.º 7
0
def stop_gobinary():
    bin_config = gobinary.config()
    host.service_stop(bin_config['binary'])
    remove_state('gobinary.started')
Ejemplo n.º 8
0
def start_gobinary():
    bin_config = gobinary.config()
    host.service_start(bin_config['binary'])
    set_state('gobinary.started')
Ejemplo n.º 9
0
def install():
    config = gobinary.config()
    install_workload(config)
    set_state('gobinary.start')
Ejemplo n.º 10
0
def stop_gobinary():
    bin_config = gobinary.config()
    host.service_stop(bin_config['binary'])
    remove_state('gobinary.started')
Ejemplo n.º 11
0
def start_gobinary():
    bin_config = gobinary.config()
    host.service_start(bin_config['binary'])
    set_state('gobinary.started')
Ejemplo n.º 12
0
def install():
    config = gobinary.config()
    install_workload(config)
    set_state('gobinary.start')