Skip to content

Commit

Permalink
Merge pull request #58 from MykytaPanoply/pan-1714_stream_ssh_stderr_…
Browse files Browse the repository at this point in the history
…to_stdout

[PAN-1714] stream ssh stderr to stdout
  • Loading branch information
MykytaPanoply authored Mar 29, 2023
2 parents 46e8ff9 + f7c4542 commit 8c3306f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion panoply/constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "2.1.1"
__version__ = "2.1.2"
__package_name__ = "panoply-python-sdk"
12 changes: 11 additions & 1 deletion panoply/ssh.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
"""
Module for storing SSH related stuff
"""
import logging
from typing import Dict
from paramiko import RSAKey, Ed25519Key, SSHException
from sshtunnel import SSHTunnelForwarder
from io import StringIO
from sys import stdout

from .errors import IncorrectParamError


def get_stdout_only_logger():
logger = logging.getLogger("STDOUTONLY")
stream_handler = logging.StreamHandler(stream=stdout)
logger.addHandler(stream_handler)
return logger


class SSHTunnel:
"""
General SSH tunnel class-component
Expand Down Expand Up @@ -144,7 +153,8 @@ def _get_server(self, platform_ssh: bool):
ssh_username=self.tunnel["username"],
ssh_password=self.tunnel.get("password"),
ssh_pkey=pkey,
remote_bind_address=(self.host, self.port)
remote_bind_address=(self.host, self.port),
logger=get_stdout_only_logger()
)
server.start()

Expand Down

0 comments on commit 8c3306f

Please sign in to comment.