예제 #1
0
파일: firepower.py 프로젝트: ox/microarmy
def _setup_a_cannon(hostname):
    """Connects to the hostname and installs all the tools required for the
    load test.

    Returns a boolean for successful setup.
    """
    ssh_conn = ssh_connect(hostname)

    # copy script to cannon and make it executable
    script_path = env_scripts_dir + '/' + CANNON_INIT_SCRIPT
    put_file(ssh_conn, script_path, CANNON_INIT_SCRIPT)
    response = exec_command(ssh_conn, 'chmod 755 ~/%s' % CANNON_INIT_SCRIPT)
    if response:  # response would be error output
        print 'Unable to chmod cannon script: %s' % (CANNON_INIT_SCRIPT)
        print response
        return False

    # copy the projectile script, for later execution
    script_path = env_scripts_dir + '/' + CANNON_PROJECTILE_SCRIPT
    put_file(ssh_conn, script_path, CANNON_PROJECTILE_SCRIPT)
    response = exec_command(ssh_conn, 'chmod 755 ~/%s' % CANNON_PROJECTILE_SCRIPT)
    if response:  # response would be error output
        print 'Unable to chmod projectile script: %s' % (CANNON_PROJECTILE_SCRIPT)
        print response
        return False

    # execute the setup script (expect this call to take a while)
    response = exec_command(ssh_conn, 'sudo ./%s' % CANNON_INIT_SCRIPT)
    print response
    return (hostname, response)
예제 #2
0
def _setup_siege_urls(hostname):
    """Connects to the hostname and configures siege

    """
    ssh_conn = ssh_connect(hostname)

    script_path = env_scripts_dir + '/' + URLS
    put_file(ssh_conn, script_path, 'urls.txt')
예제 #3
0
def _setup_siege_config(hostname):
    """Connects to the hostname and configures siege

    """
    ssh_conn = ssh_connect(hostname)

    script_path = env_scripts_dir + '/' + SIEGE_CONFIG
    put_file(ssh_conn, script_path, '.siegerc')
예제 #4
0
def _setup_siege_urls(hostname):
    """Connects to the hostname and configures siege

    """
    ssh_conn = ssh_connect(hostname)

    script_path = env_scripts_dir + '/' + URLS
    put_file(ssh_conn, script_path, 'urls.txt')
예제 #5
0
def _setup_siege_config(hostname):
    """Connects to the hostname and configures siege

    """
    ssh_conn = ssh_connect(hostname)

    script_path = env_scripts_dir + '/' + SIEGE_CONFIG
    put_file(ssh_conn, script_path, '.siegerc')
예제 #6
0
def _setup_a_cannon(hostname):
    """Connects to the hostname and installs all the tools required for the
    load test.

    Returns a boolean for successful setup.
    """
    ssh_conn = ssh_connect(hostname)

    # copy script to cannon and make it executable
    script_path = env_scripts_dir + '/' + CANNON_INIT_SCRIPT
    put_file(ssh_conn, script_path, CANNON_INIT_SCRIPT)
    response = exec_command(ssh_conn, 'chmod 755 ~/%s' % CANNON_INIT_SCRIPT)
    if response:  # response would be error output
        print 'Unable to chmod cannon script: %s' % (CANNON_INIT_SCRIPT)
        print response
        return False

    # execute the setup script (expect this call to take a while)
    response = exec_command(ssh_conn, 'sudo ./%s' % CANNON_INIT_SCRIPT)
    return (hostname, response)