Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: allow logs to show error levels for ssh tunnel #23536

Merged
merged 3 commits into from
Mar 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion superset/extensions/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ def create_tunnel(
params = {
"ssh_address_or_host": (ssh_tunnel.server_address, ssh_tunnel.server_port),
"ssh_username": ssh_tunnel.username,
"remote_bind_address": (url.host, url.port), # bind_port, bind_host
"remote_bind_address": (url.host, url.port),
"local_bind_address": (self.local_bind_address,),
"debug_level": "ERROR",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to set this to the current log level of Superset, so that in production this is ERROR, but in dev this is DEBUG or INFO, eg.

You should be able to get the current log level with something like:

logging.getLogger("flask_appbuilder").level

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I think logging.getLogger("flask_appbuilder").level is an int, you probably need to convert to a string here. Looks like you can do something like this:

log = logging.getLogger("flask_appbuilder")
str_level = logging.getLevelName(log.getEffectiveLevel())

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the package handles int as well

}

if ssh_tunnel.password:
Expand Down