diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index 2182ee32edb..6f4fc6c37d3 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -784,6 +784,14 @@ def default_for( {REPLACES}``[suite servers][run host select]rank``. ''') + Conf('ssh forward environment variables', VDR.V_STRING_LIST, '', + desc=''' + A list containing the names of the environment variables to + forward with SSH connections to the run and job hosts from + the host running 'cylc play' + + .. versionchanged:: 8.3.0 + ''') with Conf('host self-identification', desc=f''' How Cylc determines and shares the identity of the workflow host. @@ -1416,13 +1424,6 @@ def default_for( {REPLACES}``global.rc[hosts][]copyable environment variables``. ''') - Conf('ssh forward environment variables', VDR.V_STRING_LIST, '', - desc=''' - A list containing the names of the environment variables to - forward with SSH connections to the server and run hosts - - .. versionchanged:: 8.3.0 - ''') Conf('retrieve job logs', VDR.V_BOOLEAN, desc=f''' {LOG_RETR_SETTINGS['retrieve job logs']} diff --git a/cylc/flow/remote.py b/cylc/flow/remote.py index 8a72d56b6d6..51cb63d61e6 100644 --- a/cylc/flow/remote.py +++ b/cylc/flow/remote.py @@ -35,6 +35,7 @@ from cylc.flow.option_parsers import verbosity_to_opts from cylc.flow.platforms import get_platform, get_host_from_platform from cylc.flow.util import format_cmd +from cylc.flow.cfgspec.glbl_cfg import glbl_cfg def get_proc_ancestors(): @@ -299,7 +300,7 @@ def construct_ssh_cmd( 'CYLC_COVERAGE', 'CLIENT_COMMS_METH', 'CYLC_ENV_NAME', - *platform['ssh forward environment variables'], + *glbl_cfg().get(['scheduler'])['run hosts']['ssh forward environment variables'], ]: if envvar in os.environ: command.append( diff --git a/tests/unit/test_remote.py b/tests/unit/test_remote.py index 6e86ac1a410..c3c0c1ca9ff 100644 --- a/tests/unit/test_remote.py +++ b/tests/unit/test_remote.py @@ -90,17 +90,25 @@ def test_construct_rsync_over_ssh_cmd(): ] -def test_construct_ssh_cmd_forward_env(): +def test_construct_ssh_cmd_forward_env(mock_glbl_cfg): """ Test for 'ssh forward environment variables' """ import os + mock_glbl_cfg( + 'cylc.flow.remote.glbl_cfg', + ''' + [scheduler] + [[run hosts]] + ssh forward environment variables = FOO, BAR + ''' + ) + host = 'example.com' config = { 'ssh command': 'ssh', 'use login shell': None, 'cylc path': None, - 'ssh forward environment variables': ['FOO'], } # Variable isn't set, no change to command