コード例 #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
ファイル: firepower.py プロジェクト: mikeedwards/microarmy
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
ファイル: firepower.py プロジェクト: mikeedwards/microarmy
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)