def __init__(self, hostname, username=None, password=None, port=22, private_key=None, connect_timeout=None, missing_host_key=None, sock=None): super(SshShell, self).__init__(hostname=hostname, username=username, password=password, port=port, connect_timeout=connect_timeout, missing_host_key=missing_host_key) try: self._pkey = RSAKey.from_private_key(StringIO(private_key)) except SSHException: try: self._pkey = DSSKey.from_private_key(StringIO(private_key)) except SSHException: raise ValidatorException("Unknown private key format") self._sock = sock
def __init__(self, hostname, username=None, password=None, port=22, private_key=None, connect_timeout=None, missing_host_key=None, sock=None): super(SshShell, self).__init__(hostname=hostname, username=username, password=password, port=port, connect_timeout=connect_timeout, missing_host_key=missing_host_key) try: self._pkey = RSAKey.from_private_key(StringIO(private_key)) except SSHException: try: self._pkey = DSSKey.from_private_key(StringIO(private_key)) except SSHException: raise ValidatorException("Unknown private key format") self._sock = sock
def parse_private_key(private_key): try: return RSAKey.from_private_key(StringIO(private_key)) except SSHException: try: return DSSKey.from_private_key(StringIO(private_key)) except SSHException: return None
def assignKey(self, key): self.origKey = key # dump key to file self.dumpKey(self.keyPath, self.origKey) try: self._pkey = RSAKey.from_private_key(StringIO(self.origKey)) except paramiko.SSHException: try: self._pkey = DSSKey.from_private_key(StringIO(self.origKey)) except paramiko.SSHException: raise "Unknown private key format"
def assignKey(self, key): self.origKey = key # dump key to file self.dumpKey(self.keyPath, self.origKey) try: self._pkey = RSAKey.from_private_key(StringIO(self.origKey)) except paramiko.SSHException: try: self._pkey = DSSKey.from_private_key(StringIO(self.origKey)) except paramiko.SSHException: raise "Unknown private key format"