Skip to content

Commit

Permalink
Move config option to under 'run hosts'
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottWales committed Sep 13, 2023
1 parent 2536745 commit 9707f0a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
15 changes: 8 additions & 7 deletions cylc/flow/cfgspec/globalcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -1416,13 +1424,6 @@ def default_for(
{REPLACES}``global.rc[hosts][<host>]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']}
Expand Down
5 changes: 4 additions & 1 deletion cylc/flow/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -299,7 +300,9 @@ 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(
Expand Down
12 changes: 10 additions & 2 deletions tests/unit/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9707f0a

Please sign in to comment.