def install_devstack(fab_settings, string_descriptor, hostname, download_conf=False,
                     ipversion="4", patch="", proxy="", quiet=False):
    verbose = []
    if quiet:
        verbose = ['output', 'running', 'warnings']
    with settings(**fab_settings), hide(*verbose):
        if exists("/etc/gai.conf"):
            append("/etc/gai.conf", "precedence ::ffff:0:0/96  100", use_sudo=True)
        if proxy:
            warn_if_fail(put(StringIO('Acquire::http::proxy "http://proxy.esl.cisco.com:8080/";'),
                             "/etc/apt/apt.conf.d/00proxy", use_sudo=True))
            warn_if_fail(put(StringIO('Acquire::http::Pipeline-Depth "0";'),
                             "/etc/apt/apt.conf.d/00no_pipelining", use_sudo=True))
        update_time(sudo)
        if ipversion != "4":
            sudo("/sbin/sysctl -w net.ipv6.conf.all.forwarding=1")
            append("/etc/sysctl.conf", "net.ipv6.conf.all.forwarding=1", use_sudo=True)
        warn_if_fail(sudo("apt-get update"))
        warn_if_fail(sudo("apt-get install -y git python-pip"))
        warn_if_fail(run("git config --global user.email '*****@*****.**';"
                         "git config --global user.name 'Test Node'"))
        run("rm -rf ~/devstack")
        quit_if_fail(run("git clone https://github.com/openstack-dev/devstack.git"))
        if patch:
            warn_if_fail(run("git fetch https://review.openstack.org/openstack-dev/devstack {patch} "
                             "&& git cherry-pick FETCH_HEAD".format(patch)))
        warn_if_fail(put(string_descriptor, "devstack/local.conf", use_sudo=False))
        with cd("devstack"):
            warn_if_fail(run("./stack.sh"))
        if download_conf:
            get('~/devstack/openrc', "./openrc")
            get('/opt/stack/tempest/etc/tempest.conf', "./tempest.conf")
        collect_logs(run, hostname)
Beispiel #2
0
def run_services(host, settings_dict, envs=None, verbose=None, config=None):
    """
        Install OS with COI on other servers

    :param host: configuration of current lab box
    :param settings_dict: settings dictionary for Fabric
    :param envs: environment variables to inject when executing job
    :param verbose: if to hide all output or print everything
    :param config: configurations of all boxes for /etc/hosts
    """
    envs = envs or {}
    verbose = verbose or []
    if settings_dict['user'] != 'root':
        run_func = sudo
        use_sudo_flag = True
    else:
        run_func = run
        use_sudo_flag = False
    print >> sys.stderr, "FABRIC connecting to", settings_dict[
        "host_string"], host["hostname"]
    with settings(**settings_dict), hide(*verbose), shell_env(**envs):
        with cd("/root/"):
            update_time(run_func)
            run_func("apt-get update")
            run_func('DEBIAN_FRONTEND=noninteractive apt-get -y '
                     '-o Dpkg::Options::="--force-confdef" -o '
                     'Dpkg::Options::="--force-confold" dist-upgrade')
            # prepare /etc/hosts
            if config:
                append("/etc/hosts", prepare_hosts(config))
            run_func("apt-get install -y git")
            run_func(
                "git clone -b icehouse https://github.com/CiscoSystems/puppet_openstack_builder"
            )
            # use latest, not i.0 release
            #with cd("/root/puppet_openstack_builder"):
            #        run_func('git checkout i.0')
            sed("/root/puppet_openstack_builder/install-scripts/cisco.install.sh",
                "icehouse/snapshots/i.0",
                "icehouse-proposed",
                use_sudo=use_sudo_flag)
            sed("/root/puppet_openstack_builder/data/hiera_data/vendor/cisco_coi_common.yaml",
                "/snapshots/i.0",
                "-proposed",
                use_sudo=use_sudo_flag)
            with cd("/root/puppet_openstack_builder/install-scripts"):
                warn_if_fail(run_func("./setup.sh"))
                warn_if_fail(run_func('puppet agent --enable'))
                warn_if_fail(
                    run_func(
                        "puppet agent -td --server=build-server.domain.name --pluginsync"
                    ))
                collect_logs(run_func=run_func, hostname=host["hostname"])
Beispiel #3
0
def run_services(host,
                 settings_dict,
                 envs=None,
                 verbose=None,
                 config=None):
    """
        Install OS with COI on other servers

    :param host: configuration of current lab box
    :param settings_dict: settings dictionary for Fabric
    :param envs: environment variables to inject when executing job
    :param verbose: if to hide all output or print everything
    :param config: configurations of all boxes for /etc/hosts
    """
    envs = envs or {}
    verbose = verbose or []
    if settings_dict['user'] != 'root':
        run_func = sudo
        use_sudo_flag = True
    else:
        run_func = run
        use_sudo_flag = False
    print >> sys.stderr, "FABRIC connecting to", settings_dict["host_string"], host["hostname"]
    with settings(**settings_dict), hide(*verbose), shell_env(**envs):
        with cd("/root/"):
            update_time(run_func)
            run_func("apt-get update")
            run_func('DEBIAN_FRONTEND=noninteractive apt-get -y '
                     '-o Dpkg::Options::="--force-confdef" -o '
                     'Dpkg::Options::="--force-confold" dist-upgrade')
            # prepare /etc/hosts
            if config:
                append("/etc/hosts", prepare_hosts(config))
            run_func("apt-get install -y git")
            run_func("git clone -b icehouse https://github.com/CiscoSystems/puppet_openstack_builder")
            # use latest, not i.0 release
            #with cd("/root/puppet_openstack_builder"):
            #        run_func('git checkout i.0')
            sed("/root/puppet_openstack_builder/install-scripts/cisco.install.sh",
                            "icehouse/snapshots/i.0",
                            "icehouse-proposed", use_sudo=use_sudo_flag)
            sed("/root/puppet_openstack_builder/data/hiera_data/vendor/cisco_coi_common.yaml",
                            "/snapshots/i.0",
                            "-proposed", use_sudo=use_sudo_flag)
            with cd("/root/puppet_openstack_builder/install-scripts"):
                warn_if_fail(run_func("./setup.sh"))
                warn_if_fail(run_func('puppet agent --enable'))
                warn_if_fail(run_func("puppet agent -td --server=build-server.domain.name --pluginsync"))
                collect_logs(run_func=run_func, hostname=host["hostname"])
def install_devstack(settings_dict,
                     envs=None,
                     verbose=None,
                     proxy=None,
                     topo=None,
                     config=None):
    envs = envs or {}
    verbose = verbose or []
    if settings_dict['user'] != 'root':
        use_sudo_flag = True
        run_func = sudo
    else:
        use_sudo_flag = False
        run_func = run
    with settings(**settings_dict), hide(*verbose), shell_env(**envs):
        warn_if_fail(run_func("yum install -y http://rdo.fedorapeople.org/rdo-release.rpm"))
        warn_if_fail(run_func("yum install -y openstack-packstack"))

        warn_if_fail(run_func("packstack --gen-answer-file=~/answers.txt"))
        prepare_answers("~/answers.txt", topo=topo, config=config)
        # Workaround for Centos 7
        if contains("/etc/redhat-release", "CentOS Linux release 7"):
            patch = os.path.join(os.path.dirname(__file__), "centos7.patch")
            warn_if_fail(put(patch, "~/centos7.patch"))
            with cd("/usr/share/openstack-puppet"):
                run_func("patch -p1 < ~/centos7.patch")
        run_func("packstack --answer-file=~/installed_answers")
        run_func("iptables -D INPUT -j REJECT --reject-with icmp-host-prohibited")
        if exists('~/keystonerc_admin'):
            get('~/keystonerc_admin', "./openrc")
        else:
            print (red("No openrc file, something went wrong! :("))
        if exists('~/keystonerc_demo'):
            get('~/keystonerc_demo', "./openrc_demo")
        if exists('~/packstack-answers-*'):
            get('~/packstack-answers-*', ".")
        collect_logs(run_func=run_func, hostname='build_box', clean=True)
        print (green("Finished!"))
        return True
Beispiel #5
0
        slave_p_dnss = list(dns_names["private"])
        slave_p_dnss.remove(master_p_dns)

    if (args.printdns):
        print "Master DNS:         " + master_dns
        print "Master Private DNS: " + master_p_dns
        print "Slave DNSs:           " + str(slave_dnss)
        print "Slave Private DNSs:   " + str(slave_p_dnss)

    if (args.wakeup):
        utils.test_nodes(slave_dnss + [master_dns])

    if (args.start):
        utils.start_experiment(master_dns, master_p_dns, slave_dnss)

    if (args.download):
        utils.collect_logs(master_dns, slave_dnss)

    if (args.end):
        utils.stop_experiment(master_dns, slave_dnss)

    if (args.clean):
        utils.clean_logs(master_dns, slave_dnss)

    if (args.onlysubmit):
        utils.submit_application(master_dns, master_p_dns)

else:
    print "\n** Provide an action to perform!\n"
    print parser.print_help()
Beispiel #6
0
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
import ec2

# ec2.run_instances(
#     config.EC2_LOCATION,
#     config.NIMBUS_AMI,
#     config.INSTANCE_NUM,
#     config.KEY_NAME,
#     config.SECURITY_GROUP,
#     config.PLACEMENT_GROUP,
#     config.INSTANCE_TYPE);

# ec2.wait_for_instances_to_start(
#     config.EC2_LOCATION,
#     config.INSTANCE_NUM);

ip_addresses = ec2.get_ip_addresses(config.EC2_LOCATION,
                                    placement_group=config.PLACEMENT_GROUP)
print ip_addresses

utils.make_nodes_file_content(ip_addresses["public"])
utils.collect_logs(ip_addresses["public"])
# utils.clean_logs(ip_addresses["public"])

# utils.copy_binary_file_to_hosts(ip_addresses)
# utils.copy_nodes_file_to_hosts(ip_addresses)
# utils.run_experiment(ip_addresses[0])
# utils.collect_output_data(ip_addresses)

# ec2.terminate_instances(config.EC2_LOCATION);
Beispiel #7
0
def install_openstack(settings_dict,
                      envs=None,
                      verbose=None,
                      url_script=None,
                      prepare=False,
                      force=False,
                      config=None,
                      use_cobbler=False,
                      proxy=None):
    """
        Install OS with COI on build server

    :param settings_dict: settings dictionary for Fabric
    :param envs: environment variables to inject when executing job
    :param verbose: if to hide all output or print everything
    :param url_script: URl of Cisco installer script from Chris
    :param force: Use if you don't connect via interface you gonna bridge later
    :return: always true
    """
    envs = envs or {}
    verbose = verbose or []
    if settings_dict['user'] != 'root':
        use_sudo_flag = True
        run_func = sudo
    else:
        use_sudo_flag = False
        run_func = run

    with settings(**settings_dict), hide(*verbose), shell_env(**envs):
        with cd("/root/"):
            if proxy:
                warn_if_fail(
                    put(StringIO(
                        'Acquire::http::proxy "http://proxy.esl.cisco.com:8080/";'
                    ),
                        "/etc/apt/apt.conf.d/00proxy",
                        use_sudo=use_sudo_flag))
                warn_if_fail(
                    put(StringIO('Acquire::http::Pipeline-Depth "0";'),
                        "/etc/apt/apt.conf.d/00no_pipelining",
                        use_sudo=use_sudo_flag))
            run_func("apt-get update")
            run_func("apt-get install -y git")
            run_func("git config --global user.email '*****@*****.**';"
                     "git config --global user.name 'Test Node'")
            if not force and not prepare:
                update_time(run_func)
                # avoid grub and other prompts
                warn_if_fail(
                    run_func('DEBIAN_FRONTEND=noninteractive apt-get -y '
                             '-o Dpkg::Options::="--force-confdef" -o '
                             'Dpkg::Options::="--force-confold" dist-upgrade'))
                # prepare /etc/hosts file
                append("/etc/hosts", prepare_hosts(config))
                with cd("/root"):
                    warn_if_fail(
                        run_func(
                            "git clone -b icehouse "
                            "https://github.com/CiscoSystems/puppet_openstack_builder"
                        ))
                    with cd("puppet_openstack_builder"):
                        ## run the latest, not i.0 release
                        #run_func('git checkout i.0')
                        sed("/root/puppet_openstack_builder/install-scripts/cisco.install.sh",
                            "icehouse/snapshots/i.0",
                            "icehouse-proposed",
                            use_sudo=use_sudo_flag)
                        sed("/root/puppet_openstack_builder/data/hiera_data/vendor/cisco_coi_common.yaml",
                            "/snapshots/i.0",
                            "-proposed",
                            use_sudo=use_sudo_flag)
                        with cd("install-scripts"):
                            warn_if_fail(run_func("./install.sh"))
                prepare_files(
                    config,
                    paths=(
                        "/etc/puppet/data/hiera_data/user.common.yaml",
                        "/etc/puppet/data/hiera_data/user.full_ha.yaml",
                        "/etc/puppet/data/cobbler/cobbler.yaml",
                        "/etc/puppet/data/role_mappings.yaml",
                        "/etc/puppet/data/hiera_data/hostname/build_server.yaml"
                    ),
                    use_sudo_flag=use_sudo_flag)
                prepare_new_files(config,
                                  path="/etc/puppet/data/hiera_data/hostname",
                                  use_sudo_flag=use_sudo_flag)
                resolve_names(run_func, use_sudo_flag)
                result = run_func(
                    'puppet apply -v /etc/puppet/manifests/site.pp')
                tries = 1
                if use_cobbler:
                    cobbler_error = "[cobbler-sync]/returns: unable to connect to cobbler on localhost using cobbler"
                    while cobbler_error in result and tries <= APPLY_LIMIT:
                        time.sleep(60)
                        print >> sys.stderr, "Cobbler is not installed properly, running apply again"
                        result = run_func(
                            'puppet apply -v /etc/puppet/manifests/site.pp',
                            pty=False)
                        tries += 1
                error = "Error:"
                while error in result and tries <= APPLY_LIMIT:
                    time.sleep(60)
                    print >> sys.stderr, "Some errors found, running apply again"
                    result = run_func(
                        'puppet apply -v /etc/puppet/manifests/site.pp',
                        pty=False)
                    tries += 1
                if exists('/root/openrc'):
                    get('/root/openrc', "./openrc")
                else:
                    print(red("No openrc file, something went wrong! :("))
                print(green("Copying logs and configs"))
                collect_logs(
                    run_func=run_func,
                    hostname=config["servers"]["build-server"][0]["hostname"],
                    clean=True)
                print(green("Finished!"))
                return True
            elif not force and prepare:
                return True
    print(green("Finished!"))
    return True
Beispiel #8
0
    else:
        assert (not controller_p_ip == "X.X.X.X")
        worker_p_ips = list(ip_addresses["private"])
        worker_p_ips.remove(controller_p_ip)

    if (args.printip):
        print "Controller IP:         " + controller_ip
        print "Controller Private IP: " + controller_p_ip
        print "Worker IPs:           " + str(worker_ips)
        print "Worker Private IPs:   " + str(worker_p_ips)

    if (args.wakeup):
        utils.test_nodes(worker_ips + [controller_ip])

    if (args.start):
        utils.start_experiment(controller_ip, controller_p_ip, worker_ips,
                               worker_p_ips)

    if (args.download):
        utils.collect_logs(controller_ip, worker_ips)

    if (args.end):
        utils.stop_experiment(controller_ip, worker_ips)

    if (args.clean):
        utils.clean_logs(controller_ip, worker_ips)

else:
    print "\n** Provide an action to perform!\n"
    print parser.print_help()
def install_openstack(settings_dict,
                      envs=None,
                      verbose=None,
                      url_script=None,
                      prepare=False,
                      force=False,
                      config=None,
                      use_cobbler=False,
                      proxy=None):
    """
        Install OS with COI on build server

    :param settings_dict: settings dictionary for Fabric
    :param envs: environment variables to inject when executing job
    :param verbose: if to hide all output or print everything
    :param url_script: URl of Cisco installer script from Chris
    :param force: Use if you don't connect via interface you gonna bridge later
    :return: always true
    """
    envs = envs or {}
    verbose = verbose or []
    if settings_dict['user'] != 'root':
        use_sudo_flag = True
        run_func = sudo
    else:
        use_sudo_flag = False
        run_func = run

    with settings(**settings_dict), hide(*verbose), shell_env(**envs):
        with cd("/root/"):
            if proxy:
                warn_if_fail(put(StringIO('Acquire::http::proxy "http://proxy.esl.cisco.com:8080/";'),
                                 "/etc/apt/apt.conf.d/00proxy",
                                 use_sudo=use_sudo_flag))
                warn_if_fail(put(StringIO('Acquire::http::Pipeline-Depth "0";'),
                                 "/etc/apt/apt.conf.d/00no_pipelining",
                                 use_sudo=use_sudo_flag))
            run_func("apt-get update")
            run_func("apt-get install -y git")
            run_func("git config --global user.email '*****@*****.**';"
                     "git config --global user.name 'Test Node'")
            if not force and not prepare:
                update_time(run_func)
                # avoid grub and other prompts
                warn_if_fail(run_func('DEBIAN_FRONTEND=noninteractive apt-get -y '
                                      '-o Dpkg::Options::="--force-confdef" -o '
                                      'Dpkg::Options::="--force-confold" dist-upgrade'))
                # prepare /etc/hosts file
                append("/etc/hosts", prepare_hosts(config))
                with cd("/root"):
                    warn_if_fail(run_func("git clone -b icehouse "
                                          "https://github.com/CiscoSystems/puppet_openstack_builder"))
                    with cd("puppet_openstack_builder"):
                        ## run the latest, not i.0 release
                        #run_func('git checkout i.0')
                        sed("/root/puppet_openstack_builder/install-scripts/cisco.install.sh",
                            "icehouse/snapshots/i.0",
                            "icehouse-proposed", use_sudo=use_sudo_flag)
                        with cd("install-scripts"):
                            warn_if_fail(run_func("./install.sh"))
                prepare_files(config,
                              paths=(
                                  "/etc/puppet/data/hiera_data/user.common.yaml",
                                  "/etc/puppet/data/hiera_data/user.full_ha.yaml",
                                  "/etc/puppet/data/cobbler/cobbler.yaml",
                                  "/etc/puppet/data/role_mappings.yaml",
                                  "/etc/puppet/data/hiera_data/hostname/build_server.yaml"
                              ),
                              use_sudo_flag=use_sudo_flag)
                prepare_new_files(
                    config,
                    path="/etc/puppet/data/hiera_data/hostname",
                    use_sudo_flag=use_sudo_flag
                )
                resolve_names(run_func, use_sudo_flag)
                result = run_func('puppet apply -v /etc/puppet/manifests/site.pp')
                tries = 1
                if use_cobbler:
                    cobbler_error = "[cobbler-sync]/returns: unable to connect to cobbler on localhost using cobbler"
                    while cobbler_error in result and tries <= APPLY_LIMIT:
                        time.sleep(60)
                        print >> sys.stderr, "Cobbler is not installed properly, running apply again"
                        result = run_func('puppet apply -v /etc/puppet/manifests/site.pp', pty=False)
                        tries += 1
                error = "Error:"
                while error in result and tries <= APPLY_LIMIT:
                    time.sleep(60)
                    print >> sys.stderr, "Some errors found, running apply again"
                    result = run_func('puppet apply -v /etc/puppet/manifests/site.pp', pty=False)
                    tries += 1
                if exists('/root/openrc'):
                    get('/root/openrc', "./openrc")
                else:
                    print (red("No openrc file, something went wrong! :("))
                print (green("Copying logs and configs"))
                collect_logs(run_func=run_func, hostname=config["servers"]["build-server"]["hostname"], clean=True)
                print (green("Finished!"))
                return True
            elif not force and prepare:
                return True
    print (green("Finished!"))
    return True
def install_openstack(settings_dict, envs=None, verbose=None, url_script=None, prepare=False, force=False):
    """
    Install OS with COI with script provided by Chris on any host(s)

    :param settings_dict: settings dictionary for Fabric
    :param envs: environment variables to inject when executing job
    :param verbose: if to hide all output or print everything
    :param url_script: URl of Cisco installer script from Chris
    :param force: Use if you don't connect via interface you gonna bridge later
    :return: always true
    """
    envs = envs or {}
    verbose = verbose or []
    if settings_dict['user'] != 'root':
        use_sudo_flag = True
        run_func = sudo
    else:
        use_sudo_flag = False
        run_func = run

    with settings(**settings_dict), hide(*verbose), shell_env(**envs):
        # TODO: check statuses of commands
        with cd("/root/"):
            warn_if_fail(run_func("apt-get update"))
            ## avoid grub and other prompts
            warn_if_fail(run_func('DEBIAN_FRONTEND=noninteractive apt-get -y '
                                  '-o Dpkg::Options::="--force-confdef" -o '
                                  'Dpkg::Options::="--force-confold" dist-upgrade'))
            warn_if_fail(run_func("apt-get install -y git"))
            warn_if_fail(run_func("git config --global user.email '*****@*****.**';"
                                  "git config --global user.name 'Test Node'"))
            warn_if_fail(sed("/etc/hosts", "127.0.1.1.*",
                             "127.0.1.1 all-in-one all-in-one.domain.name", use_sudo=use_sudo_flag))
            warn_if_fail(put(StringIO("all-in-one"), "/etc/hostname", use_sudo=use_sudo_flag))
            warn_if_fail(run_func("hostname all-in-one"))
            if use_sudo_flag:
                append("/etc/sudoers",
                       "{user} ALL=(ALL) NOPASSWD: ALL".format(user=settings_dict['user']),
                       use_sudo=True)
            warn_if_fail(run_func("git clone -b icehouse "
                                  "https://github.com/CiscoSystems/puppet_openstack_builder"))
            if not force and not prepare:
                with cd("puppet_openstack_builder"):
                    ## run the latest, not i.0 release
                    sed("/root/puppet_openstack_builder/install-scripts/cisco.install.sh",
                        "icehouse/snapshots/i.0",
                        "icehouse-proposed", use_sudo=use_sudo_flag)
                    sed("/root/puppet_openstack_builder/data/hiera_data/vendor/cisco_coi_common.yaml",
                            "/snapshots/i.0",
                            "-proposed", use_sudo=use_sudo_flag)
                    with cd("install-scripts"):
                        run_func("./install.sh")
                        result = run_func('puppet apply -v /etc/puppet/manifests/site.pp', pty=False)
                        tries = 1
                        error = "Error:"
                        while error in result and tries <= APPLY_LIMIT:
                            time.sleep(60)
                            print >> sys.stderr, "Some errors found, running apply again"
                            result = run_func('puppet apply -v /etc/puppet/manifests/site.pp', pty=False)
                            tries += 1
                if exists('/root/openrc'):
                    get('/root/openrc', "./openrc")
                else:
                    print (red("No openrc file, something went wrong! :("))
                print (green("Copying logs and configs"))
                collect_logs(run_func=run_func, hostname="aio", clean=True)
                print (green("Finished!"))
                return True
    if force and not prepare:
        shell_envs = ";".join(["export " + k + "=" + v for k, v in envs.iteritems()]) or ""
        sudo_mode = "sudo " if use_sudo_flag else ''
        if not settings_dict['gateway']:
            local("{shell_envs}; ssh -t -t -i {id_rsa} {user}@{host} \
             '/bin/bash /root/install_icehouse_cisco.sh'".format(
                shell_envs=shell_envs,
                id_rsa=settings_dict['key_filename'],
                user=settings_dict['user'],
                host=settings_dict['host_string']))
            local("scp -i {id_rsa} {user}@{host}:/root/openrc ./openrc".format(
                id_rsa=settings_dict['key_filename'],
                user=settings_dict['user'],
                host=settings_dict['host_string']))
        else:
            local('ssh -t -t -i {id_rsa} {user}@{gateway} \
             "{shell_envs}; ssh -t -t -i {id_rsa} {user}@{host} \
             \'{sudo_mode}/bin/bash /root/install_icehouse_cisco.sh\'"'.format(
                shell_envs=shell_envs,
                id_rsa=settings_dict['key_filename'],
                user=settings_dict['user'],
                host=settings_dict['host_string'],
                gateway=settings_dict['gateway'],
                sudo_mode=sudo_mode))
            local('scp -Cp -o "ProxyCommand ssh {user}@{gateway} '
                  'nc {host} 22" root@{host}:/root/openrc ./openrc'.format(
                      user=settings_dict['user'],
                      host=settings_dict['host_string'],
                      gateway=settings_dict['gateway'],
                  ))
    print (green("Finished!"))
    return True
Beispiel #11
0
def install(aggregated_configs, apt_cacher_proxy=None,
            patch="", proxy="", devstack_repo="", devstack_br="", quiet=False):
    verbose = []
    fab_settings = aggregated_configs[env.host]["fab_settings"]
    local_conf = aggregated_configs[env.host]["devstack_config"]
    config_files = aggregated_configs[env.host]["config_files"]
    hostname = aggregated_configs[env.host]["hostname"]
    exec_command_before = aggregated_configs[env.host]["exec_commands_before"]
    exec_command_after = aggregated_configs[env.host]["exec_commands_after"]
    if quiet:
        verbose = ['output', 'running', 'warnings']
    with settings(**fab_settings), hide(*verbose):
        if exists("/etc/gai.conf"):
            append("/etc/gai.conf", "precedence ::ffff:0:0/96  100",
                   use_sudo=True)
        if proxy:
            warn_if_fail(put(StringIO(
                'Acquire::http::proxy "http://proxy.esl.cisco.com:8080/";'),
                             "/etc/apt/apt.conf.d/00proxy", use_sudo=True))
            warn_if_fail(put(StringIO('Acquire::http::Pipeline-Depth "0";'),
                             "/etc/apt/apt.conf.d/00no_pipelining",
                             use_sudo=True))
        if apt_cacher_proxy:
            warn_if_fail(
                put(StringIO('Acquire::http { Proxy "{url}"; };'.format(
                    url=apt_cacher_proxy)),
                    "/etc/apt/apt.conf.d/02proxy", use_sudo=True))
        update_time(sudo)
        warn_if_fail(sudo("apt-get update"))
        warn_if_fail(sudo("apt-get install -y git python-pip"))
        warn_if_fail(
            run("git config --global user.email '*****@*****.**';"
                "git config --global user.name 'Test Node'"))
        if exists("devstack"):
            with cd("devstack"):
                warn_if_fail(run("./unstack.sh"))
        run("rm -rf ~/devstack")
        quit_if_fail(run(
            "git clone -b {branch} {devstack}".format(devstack=devstack_repo,
                                                      branch=devstack_br)))
        if patch:
            with cd("devstack"):
                warn_if_fail(
                    run(
                        "git fetch https://review.openstack.org/openstack-dev/devstack {patch} "
                        "&& git cherry-pick FETCH_HEAD".format(patch=patch)))
        warn_if_fail(put(StringIO(local_conf), "devstack/local.conf"))
        if exec_command_before:
            run(exec_command_before)
        if config_files:
            for path, conf_file in config_files.iteritems():
                warn_if_fail(put(StringIO(conf_file), path))
        with cd("devstack"):
            warn_if_fail(run("./stack.sh"))
        path = os.environ.get("WORKSPACE", os.getcwd())
        if os.path.exists(
                "{path}/id_rsa_{key}".format(path=path, key=hostname)):
            path = os.environ.get("WORKSPACE", os.getcwd())
            put("{path}/id_rsa_{key}".format(path=path, key=hostname),
                "~/.ssh/id_rsa")
            put("{path}/id_rsa_{key}.pub".format(path=path, key=hostname),
                "~/.ssh/id_rsa.pub")
            put("{0}/id_rsa_all.pub".format(path), "/tmp/all_authorized")
            warn_if_fail(run("chmod 500 ~/.ssh/id_rsa"))
            warn_if_fail(
                run("cat /tmp/all_authorized >> ~/.ssh/authorized_keys"))
            append("/etc/ssh/ssh_config",
                   "\nStrictHostKeyChecking no\nUserKnownHostsFile=/dev/null",
                   use_sudo=True)
        if exec_command_after:
            run(exec_command_after)
        collect_logs(run, hostname)
        collect_logs_devstack("install_{host}".format(host=hostname))
Beispiel #12
0
                                  placement_group=config.PLACEMENT_GROUP)

    worker_dnss = list(dns_names["public"])
    if (not args.useprivate):
        worker_p_dnss = list(worker_dnss)
    else:
        worker_p_dnss = list(dns_names["private"])

    if (args.printdns):
        print "Worker DNSs:           " + str(worker_dnss)
        print "Worker Private DNSs:   " + str(worker_p_dnss)

    if (args.wakeup):
        utils.test_nodes(worker_dnss)

    if (args.start):
        utils.start_experiment(worker_dnss, worker_p_dnss)

    if (args.download):
        utils.collect_logs(worker_dnss)

    if (args.end):
        utils.stop_experiment(worker_dnss)

    if (args.clean):
        utils.clean_logs(worker_dnss)

else:
    print "\n** Provide an action to perform!\n"
    print parser.print_help()