Merge pull request #21 from akfmdl/refactor/remove-duplicate-code

refactor: duplicate environ value
This commit is contained in:
Jake Henning 2023-04-10 08:54:47 +03:00 committed by GitHub
commit a1c21fdb1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -499,7 +499,7 @@ def setup_ssh_server(hostname, hostnames, param, task, env):
'echo "export CLEARML_CONFIG_FILE={trains_config_file}" >> /etc/profile'.format( 'echo "export CLEARML_CONFIG_FILE={trains_config_file}" >> /etc/profile'.format(
password=ssh_password, password=ssh_password,
port=port, port=port,
trains_config_file=os.environ.get("CLEARML_CONFIG_FILE") or os.environ.get("CLEARML_CONFIG_FILE"), trains_config_file=os.environ.get("CLEARML_CONFIG_FILE") or os.environ.get("TRAINS_CONFIG_FILE"),
) )
) )
sshd_path = '/usr/sbin/sshd' sshd_path = '/usr/sbin/sshd'
@ -510,7 +510,7 @@ def setup_ssh_server(hostname, hostnames, param, task, env):
# noinspection PyBroadException # noinspection PyBroadException
try: try:
os.system('echo "export CLEARML_CONFIG_FILE={trains_config_file}" >> $HOME/.profile'.format( os.system('echo "export CLEARML_CONFIG_FILE={trains_config_file}" >> $HOME/.profile'.format(
trains_config_file=os.environ.get("CLEARML_CONFIG_FILE") or os.environ.get("CLEARML_CONFIG_FILE"), trains_config_file=os.environ.get("CLEARML_CONFIG_FILE") or os.environ.get("TRAINS_CONFIG_FILE"),
)) ))
except Exception: except Exception:
print("warning failed setting ~/.profile") print("warning failed setting ~/.profile")