'Configure a node to be able to connect to other similarly configured
Flocker nodes.
This will block until the operation is complete.
:param bytes host: The hostname or IP address of the node to configure.
:param int port: The port number of the SSH server on that node.'

def configure_ssh(self, host, port):

    if isinstance(host, IPv4Address):
        host = unicode(host).encode('ascii')
    local_private_path = self.ssh_config_path.child('id_rsa_flocker')
    local_public_path = local_private_path.siblingExtension('.pub')
    remote_private_path = self.flocker_path.child('id_rsa_flocker')
    remote_public_path = remote_private_path.siblingExtension('.pub')
    write_authorized_key = u"mkdir    -p    .ssh;    if    !    grep    --quiet    '{public_key}'    .ssh/authorized_keys;    then        (                echo;                    echo    '#    flocker-deploy    access';                    echo    '{public_key}';            )    >>    .ssh/authorized_keys;    fi;    ".format(public_key=local_public_path.getContent().strip())
    generate_flocker_key = u"umask    u=rwx,g=,o=;    mkdir    -p    {};    echo    '{}'    >    '{}';    echo    '{}'    >    '{}';    chmod    u=rw,g=,o=    {};    chmod    u=rw,g=r,o=r    {}".format(remote_public_path.parent().path, local_public_path.getContent().strip(), remote_public_path.path, local_private_path.getContent().strip(), remote_private_path.path, remote_private_path.path, remote_public_path.path)
    commands = (write_authorized_key + generate_flocker_key)
    ssh([u'-oPort={}'.format(port).encode('ascii'), '-oStrictHostKeyChecking=no', '-o', 'PreferredAuthentications=publickey', '-oControlMaster=no', '-l', 'root', host, commands.encode('ascii')])
