Exemplo n.º 1
0
def command(xenhost, xenpass, devstackpass, tempest_params, tempest_repo,
            tempest_branch, no_clone, devstack_ip, suite):

    if not devstack_ip:
        xen = Server(xenhost, 'root', xenpass)
        xen.disable_known_hosts = True

        while True:
            devstack_ip = get_devstack_ip(xen)
            if devstack_ip:
                break
            time.sleep(1)

    devstack = Server(devstack_ip, 'stack', devstackpass)
    devstack.disable_known_hosts = True

    do_clone = not no_clone

    if do_clone:
        devstack.run(
            "rm -rf /opt/stack/tempest")
        devstack.run(
            "cd /opt/stack && git clone %s" % tempest_repo)
    else:
        devstack.run(
            "cd /opt/stack/tempest && git pull")

    devstack.run(
        "cd /opt/stack/tempest && git checkout %s" % tempest_branch)
    devstack.run(
        "/opt/stack/devstack/tools/configure_tempest.sh")
    devstack.run(
        "sudo pip install -U nose || true")

    temp_ini_file = tempfile.NamedTemporaryFile(delete=False)
    temp_ini_file.close()

    tempest_conf = "/opt/stack/tempest/etc/tempest.conf"
    devstack.get(tempest_conf, temp_ini_file.name)
    edit_ini_file(temp_ini_file.name)
    devstack.put(temp_ini_file.name, tempest_conf)

    devstack.run(
        "rm -f "
        "/opt/stack/tempest/tempest/tests/compute/test_console_output.py")
    devstack.run(
        """cd /opt/stack/tempest && nosetests %s %s -v -e "test_change_server_password" """
        % (suite, tempest_params))

    disconnect_all()
Exemplo n.º 2
0
def command(host, filename, user, password):
    server = Server(host, user, password)
    server.disable_known_hosts = True

    extra_config = sys.stdin.readlines()

    tmp = tempfile.NamedTemporaryFile(delete=False)
    tmp.file.close()

    try:
        server.get(filename, tmp.name)
        set_extra_config(tmp.name, extra_config)
        server.put(tmp.name, filename)
    finally:
        disconnect_all()