3 L]K@sddlZGdddeZGdddeZGdddeZGdd d eZGd d d eZGd d d eZGdddeZGdddeZ Gdddej Z dS)Nc@seZdZdZdS) SSHExceptionzT Exception raised by failures in SSH2 protocol negotiation or logic errors. N)__name__ __module__ __qualname____doc__rrszBadAuthenticationType.__init__cCsdj|j|jS)Nz{}; allowed types: {!r})formatr r)rrrr__str__EszBadAuthenticationType.__str__N)rrrrrr rrrrrr 2sr c@s$eZdZdZgZddZddZdS)PartialAuthenticationzM An internal exception thrown in the case of partial authentication. cCstj||||_dS)N)r r r)rrrrrr Rs zPartialAuthentication.__init__cCs dj|jS)Nz+Partial authentication; allowed types: {!r})rr)rrrrrVszPartialAuthentication.__str__N)rrrrrr rrrrrrKsrc@s eZdZdZddZddZdS)ChannelExceptionz Exception raised when an attempt to open a new `.Channel` fails. :param int code: the error code returned by the server .. versionadded:: 1.6 cCstj|||||_||_dS)N)rr codetext)rrrrrrr eszChannelException.__init__cCsdj|j|jS)NzChannelException({!r}, {!r}))rrr)rrrrrjszChannelException.__str__N)rrrrr rrrrrr\src@s eZdZdZddZddZdS)BadHostKeyExceptiona The host key given by the SSH server did not match what we were expecting. :param str hostname: the hostname of the SSH server :param PKey got_key: the host key presented by the server :param PKey expected_key: the host key expected .. versionadded:: 1.6 cCs&tj||||||_||_||_dS)N)rr hostnamekey expected_key)rrZgot_keyrrrrr yszBadHostKeyException.__init__cCs d}|j|j|jj|jjS)Nz@Host key for server '{}' does not match: got '{}', expected '{}')rrrZ get_base64r)rmsgrrrrs zBadHostKeyException.__str__N)rrrrr rrrrrrns rc@s eZdZdZddZddZdS)ProxyCommandFailurez The "ProxyCommand" found in the .ssh/config file returned an error. :param str command: The command line that is generating this exception. :param str error: The error captured from the proxy command output. cCstj|||||_||_dS)N)rr commanderror)rrrrrrr szProxyCommandFailure.__init__cCsdj|j|jS)Nz3ProxyCommand("{}") returned nonzero exit status: {})rrr)rrrrrszProxyCommandFailure.__str__N)rrrrr rrrrrrsrcs(eZdZdZfddZddZZS)NoValidConnectionsErrora Multiple connection attempts were made and no families succeeded. This exception class wraps multiple "real" underlying connection errors, all of which represent failed connection attempts. Because these errors are not guaranteed to all be of the same error type (i.e. different errno, `socket.error` subclass, message, etc) we expose a single unified error message and a ``None`` errno so that instances of this class match most normal handling of `socket.error` objects. To see the wrapped exception objects, access the ``errors`` attribute. ``errors`` is a dict whose keys are address tuples (e.g. ``('127.0.0.1', 22)``) and whose values are the exception encountered trying to connect to that address. It is implied/assumed that all the errors given to a single instance of this class are from connecting to the same hostname + port (and thus that the differences are in the resolution of the hostname - e.g. IPv4 vs v6). .. versionadded:: 1.16 cspt|j}djdd|dd D}|d d}|r>d}nd}tt|jd|j|dd||||_dS) zl :param dict errors: The errors dict to store, as described by class docstring. z, cSsg|] }|dqS)rr).0xrrr sz4NoValidConnectionsError.__init__..Nrz+Unable to connect to port {0} on {1} or {2}z$Unable to connect to port {0} on {2}r$)sortedkeysjoinsuperrr rerrors)rr)addrsbodytailr) __class__rrr s   z NoValidConnectionsError.__init__cCs|j|jffS)N)r-r))rrrr __reduce__sz"NoValidConnectionsError.__reduce__)rrrrr r. __classcell__rr)r-rrs r) socket Exceptionrr r r rrrrrrrrrrs