Beispiel #1
0
def kill():
    """
    Kills ALL running job managers (and the relative search nodes) on the
    hosts provided by the context or (by default) on all known hosts.
    """
    with shell.ignore_warnings():
        shell.remote('pkill "jobmgr|popc_*"', sudo=True)
def command(_=None):
    """
    Exchanges the public keys between all VMs to allow direct ssh connections
    between them without user input.
    """
    local, remote = settings.PATHS['configuration']
    local = os.path.join(local, 'authorized_keys')
    remote = os.path.join(remote, 'authorized_keys')

    with shell.ignore_warnings():
        shell.local('rm {0}'.format(local))

    # Collect all keys in one file
    shell.remote('cat $HOME/.ssh/id_rsa.pub >>{0}'.format(remote))

    # Copy first authorized key (host machine) to temp location
    shell.remote('head -1 $HOME/.ssh/authorized_keys ' \
                 '>$HOME/.ssh/authorized_keys.tmp')

    # Append all other keys
    shell.remote('cat {0} >>$HOME/.ssh/authorized_keys.tmp'.format(remote))

    # Move to the original location
    shell.remote('mv $HOME/.ssh/authorized_keys.tmp ' \
                 '$HOME/.ssh/authorized_keys')

    # Add all hosts to the known_hosts file
    shell.remote('cat $HOME/.ssh/authorized_keys | '\
                 'awk -F \' \' \'{print $3}\' | ' \
                 'grep -E \'[0-9.]{7,15}\' | ' \
                 'ssh-keyscan -f - -H -t rsa >$HOME/.ssh/known_hosts')

    shell.local('rm {0}'.format(local))
Beispiel #3
0
def kill():
    """
    Kills ALL running measures on the hosts provided by the context or
    (by default) on all known hosts.
    """
    with shell.ignore_warnings():
        shell.remote('pkill "tshark"', sudo=True)