'Create a new node, and start deployment.
In order to be able to SSH into a created node access credentials are
required.
A user can pass either a :class:`.NodeAuthPassword` or
:class:`.NodeAuthSSHKey` to the ``auth`` argument. If the
``create_node`` implementation supports that kind if credential (as
declared in ``self.features[\'create_node\']``) then it is passed on to
``create_node``. Otherwise it is not passed on to ``create_node`` and
it is only used for authentication.
If the ``auth`` parameter is not supplied but the driver declares it
supports ``generates_password`` then the password returned by
``create_node`` will be used to SSH into the server.
Finally, if the ``ssh_key_file`` is supplied that key will be used to
SSH into the server.
This function may raise a :class:`DeploymentException`, if a
create_node call was successful, but there is a later error (like SSH
failing or timing out).  This exception includes a Node object which
you may want to destroy if incomplete deployments are not desirable.
>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> from libcloud.compute.deployment import ScriptDeployment
>>> from libcloud.compute.deployment import MultiStepDeployment
>>> from libcloud.compute.base import NodeAuthSSHKey
>>> driver = DummyNodeDriver(0)
>>> key = NodeAuthSSHKey(\'...\') # read from file
>>> script = ScriptDeployment("yum -y install emacs strace tcpdump")
>>> msd = MultiStepDeployment([key, script])
>>> def d():
...     try:
...         driver.deploy_node(deploy=msd)
...     except NotImplementedError:
...         print ("not implemented for dummy driver")
>>> d()
not implemented for dummy driver
Deploy node is typically not overridden in subclasses.  The
existing implementation should be able to handle most such.
:param deploy: Deployment to run once machine is online and
available to SSH.
:type deploy: :class:`Deployment`
:param ssh_username: Optional name of the account which is used
when connecting to
SSH server (default is root)
:type ssh_username: ``str``
:param ssh_alternate_usernames: Optional list of ssh usernames to
try to connect with if using the
default one fails
:type ssh_alternate_usernames: ``list``
:param ssh_port: Optional SSH server port (default is 22)
:type ssh_port: ``int``
:param ssh_timeout: Optional SSH connection timeout in seconds
(default is 10)
:type ssh_timeout: ``float``
:param auth:   Initial authentication information for the node
(optional)
:type auth:   :class:`.NodeAuthSSHKey` or :class:`NodeAuthPassword`
:param ssh_key: A path (or paths) to an SSH private key with which
to attempt to authenticate. (optional)
:type ssh_key: ``str`` or ``list`` of ``str``
:param timeout: How many seconds to wait before timing out.
(default is 600)
:type timeout: ``int``
:param max_tries: How many times to retry if a deployment fails
before giving up (default is 3)
:type max_tries: ``int``
:param ssh_interface: The interface to wait for. Default is
\'public_ips\', other option is \'private_ips\'.
:type ssh_interface: ``str``'

def deploy_node(self, **kwargs):

    if (not libcloud.compute.ssh.have_paramiko):
        raise RuntimeError(('paramiko    is    not    installed.    You    can    install    ' + 'it    using    pip:    pip    install    paramiko'))
    if ('auth' in kwargs):
        auth = kwargs['auth']
        if (not isinstance(auth, (NodeAuthSSHKey, NodeAuthPassword))):
            raise NotImplementedError('If    providing    auth,    only    NodeAuthSSHKey    orNodeAuthPassword    is    supported')
    elif ('ssh_key' in kwargs):
        pass
    elif ('create_node' in self.features):
        f = self.features['create_node']
        if (('generates_password' not in f) and ('password' not in f)):
            raise NotImplementedError('deploy_node    not    implemented    for    this    driver')
    else:
        raise NotImplementedError('deploy_node    not    implemented    for    this    driver')
    node = self.create_node(**kwargs)
    max_tries = kwargs.get('max_tries', 3)
    password = None
    if ('auth' in kwargs):
        if isinstance(kwargs['auth'], NodeAuthPassword):
            password = kwargs['auth'].password
    elif ('password' in node.extra):
        password = node.extra['password']
    ssh_interface = kwargs.get('ssh_interface', 'public_ips')
    try:
        (node, ip_addresses) = self.wait_until_running(nodes=[node], wait_period=3, timeout=kwargs.get('timeout', NODE_ONLINE_WAIT_TIMEOUT), ssh_interface=ssh_interface)[0]
    except Exception:
        e = sys.exc_info()[1]
        raise DeploymentError(node=node, original_exception=e, driver=self)
    ssh_username = kwargs.get('ssh_username', 'root')
    ssh_alternate_usernames = kwargs.get('ssh_alternate_usernames', [])
    ssh_port = kwargs.get('ssh_port', 22)
    ssh_timeout = kwargs.get('ssh_timeout', 10)
    ssh_key_file = kwargs.get('ssh_key', None)
    timeout = kwargs.get('timeout', SSH_CONNECT_TIMEOUT)
    deploy_error = None
    for username in ([ssh_username] + ssh_alternate_usernames):
        try:
            self._connect_and_run_deployment_script(task=kwargs['deploy'], node=node, ssh_hostname=ip_addresses[0], ssh_port=ssh_port, ssh_username=username, ssh_password=password, ssh_key_file=ssh_key_file, ssh_timeout=ssh_timeout, timeout=timeout, max_tries=max_tries)
        except Exception:
            e = sys.exc_info()[1]
            deploy_error = e
        else:
            deploy_error = None
            break
    if (deploy_error is not None):
        raise DeploymentError(node=node, original_exception=deploy_error, driver=self)
    return node
