1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-03 00:07:05 +00:00

update ssh get config value: tabs instead of spaces, ssh port can return None

This commit is contained in:
KiekerJan 2024-03-10 14:16:56 +01:00
parent 4e64518881
commit bdda55413c

View File

@ -180,10 +180,15 @@ def wait_for_service(port, public, env, timeout):
time.sleep(min(timeout/4, 1))
def get_ssh_port():
return int(get_ssh_config_value("port"))
port_value = get_ssh_config_value("port")
if port_value:
return int(port_value)
return None
def get_ssh_config_value(parameter_name):
# Returns ssh port
# Returns ssh configuration value for the provided parameter
try:
output = shell('check_output', ['sshd', '-T'])
except FileNotFoundError:
@ -200,7 +205,7 @@ def get_ssh_config_value(parameter_name):
if e == parameter_name:
returnNext = True
# Did not find port!
# Did not find the parameter!
return None
if __name__ == "__main__":