示例#1
0
def wants_etcd():
    if host.service_available('zetcd') and host.service_running('zetcd'):
        host.service_stop('zetcd')
    hookenv.close_port(2181)
    try:
        os.unlink('/etc/systemd/system/zetcd.service')
    except:
        pass
    hookenv.status_set('blocked', 'waiting for relation to etcd')
示例#2
0
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)
示例#3
0
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)
def fix_ifmap_server():
    # disable ifmap-server upstart service
    if service_available("ifmap-server"):
        service_stop("ifmap-server")
        with open("/etc/init/ifmap-server.override", "w") as conf:
            conf.write("manual\n")

    # use supervisord config
    shutil.copy("files/ifmap.ini", "/etc/contrail/supervisord_config_files")
    pw = pwd.getpwnam("contrail")
    os.chown("/etc/contrail/supervisord_config_files/ifmap.ini", pw.pw_uid,
             pw.pw_gid)
    shutil.copy("files/ifmap", "/etc/init.d")
    os.chmod("/etc/init.d/ifmap", 0755)
示例#5
0
def fix_webui_middleware():
    # disable webui middleware upstart service
    if service_available('contrail-webui-jobserver'):
        service_stop('contrail-webui-jobserver')
        with open('/etc/init/contrail-webui-jobserver.override', 'w') as conf:
            conf.write('manual\n')

    # use supervisord config
    conf = 'files/contrail-webui-middleware-opencontrail.ini' \
           if is_opencontrail() \
           else 'files/contrail-webui-middleware-contrail.ini'
    shutil.copy(conf, '/etc/contrail/supervisord_webui_files/contrail-webui-middleware.ini')
    pw = pwd.getpwnam('contrail')
    os.chown('/etc/contrail/supervisord_webui_files/contrail-webui-middleware.ini',
             pw.pw_uid, pw.pw_gid)
    shutil.copy('files/contrail-webui-middleware', '/etc/init.d')
    os.chmod('/etc/init.d/contrail-webui-middleware', 0o755)
示例#6
0
def fix_webui():
    # disable webui upstart service
    if service_available('contrail-webui-webserver'):
        service_stop('contrail-webui-webserver')
        with open('/etc/init/contrail-webui-webserver.override', 'w') as conf:
            conf.write('manual\n')

    # use supervisord config
    conf = 'files/contrail-webui-opencontrail.ini' \
           if is_opencontrail() \
           else 'files/contrail-webui-contrail.ini'
    shutil.copy(conf,
                '/etc/contrail/supervisord_webui_files/contrail-webui.ini')
    pw = pwd.getpwnam('contrail')
    os.chown('/etc/contrail/supervisord_webui_files/contrail-webui.ini',
             pw.pw_uid, pw.pw_gid)
    shutil.copy('files/contrail-webui', '/etc/init.d')
    os.chmod('/etc/init.d/contrail-webui', 0o755)
示例#7
0
def install_tfdemo():
    shutil.copyfile("bin/tfwebapp", "/usr/bin/tfwebapp")
    os.chmod("/usr/bin/tfwebapp", 0o755)
    if host.service_available('tfdemo') and host.service_running('tfdemo'):
        host.service_restart('tfdemo')
    set_state('tfdemo.installed')