コード例 #1
0
def create_and_copy_service_token():
    service_token = get_service_token() or run("openssl rand -hex 10")
    for host_string in env.roledefs['openstack']:
        with settings(host_string=host_string):
            if (files.exists('/etc/contrail/service.token') and env.roledefs['openstack'].index(host_string) == 0):
                service_token = run("cat /etc/contrail/service.token")
            else:
                run("echo '%s' > /etc/contrail/service.token" % service_token)
コード例 #2
0
ファイル: ha.py プロジェクト: sajuptpm/contrail-fabric-utils
def create_and_copy_service_token():
    service_token = get_service_token() or run("openssl rand -hex 10")
    for host_string in env.roledefs['openstack']:
        with settings(host_string=host_string):
            if (files.exists('/etc/contrail/service.token') and env.roledefs['openstack'].index(host_string) == 0):
                service_token = run("cat /etc/contrail/service.token")
            else:
                run("echo '%s' > /etc/contrail/service.token" % service_token)
コード例 #3
0
def create_and_copy_service_token():
    service_token = get_service_token() or sudo("openssl rand -hex 10")
    for host_string in env.roledefs["openstack"]:
        with settings(host_string=host_string):
            if (
                files.exists("/etc/contrail/service.token", use_sudo=True)
                and env.roledefs["openstack"].index(host_string) == 0
            ):
                service_token = sudo("cat /etc/contrail/service.token")
            else:
                sudo("echo '%s' > /etc/contrail/service.token" % service_token)