def test_unexpandable_symlink_env_var_returns_failed(mocked_expandvars, capsys): """Test unexpandable symlinks return REMOTE INIT FAILED""" mocked_expandvars.side_effect = ['some/rund/path', '$blah'] remote_init('test_install_target', 'some_rund', 'run=$blah') assert capsys.readouterr().out == ( "REMOTE INIT FAILED\nError occurred when symlinking." " $blah contains an invalid environment variable.\n")
def test_existing_key_raises_error(tmp_path: Path, capsys: CaptureFixture): """Test .service directory that contains existing incorrect key, results in REMOTE INIT FAILED""" rundir = tmp_path / 'some_rund' srvdir = rundir / SuiteFiles.Service.DIRNAME srvdir.mkdir(parents=True) (srvdir / 'client_wrong.key').touch() remote_init('test_install_target', str(rundir)) assert capsys.readouterr().out == ( "REMOTE INIT FAILED\nUnexpected authentication key" " \"client_wrong.key\" exists. Check global.cylc install target is" " configured correctly for this platform.\n")
def test_existing_client_key_dir_raises_error(tmp_path: Path, capsys: CaptureFixture): """Test .service directory that contains existing incorrect key, results in REMOTE INIT FAILED """ rundir = tmp_path / 'some_rund' keydir = rundir / SuiteFiles.Service.DIRNAME / "client_public_keys" keydir.mkdir(parents=True) remote_init('test_install_target', rundir) assert capsys.readouterr().out == ( f"REMOTE INIT FAILED\nUnexpected key directory exists: {keydir}" " Check global.cylc install target is configured correctly for this" " platform.\n")
def main(): from cylc.flow.option_parsers import CylcOptionParser as COP from cylc.flow.task_remote_cmd import remote_init parser = COP( __doc__, argdoc=[ ("INSTALL_TARGET", "Target to be initialised"), ("RUND", "The run directory of the suite"), ], ) parser.add_option( "--indirect-comm", metavar="METHOD", type="choice", choices=["ssh"], help="specify use of indirect communication via e.g. ssh", action="store", dest="indirect_comm", default=None, ) options, (install_target, rund) = parser.parse_args() remote_init(install_target, rund, indirect_comm=options.indirect_comm)
def main(): if not remrun(): from cylc.flow.option_parsers import CylcOptionParser as COP from cylc.flow.task_remote_cmd import remote_init parser = COP( __doc__, argdoc=[ ("UUID", "UUID of current suite server process"), ("RUND", "The run directory of the suite"), ], ) parser.add_option( "--indirect-comm", metavar="METHOD", type="choice", choices=["ssh"], help="specify use of indirect communication via e.g. ssh", action="store", dest="indirect_comm", default=None, ) options, (uuid_str, rund) = parser.parse_args() remote_init(uuid_str, rund, indirect_comm=options.indirect_comm)
def main(parser, options, install_target, rund): remote_init(install_target, rund, indirect_comm=options.indirect_comm)
def main(parser, options, install_target, rund, *dirs_to_be_symlinked): remote_init(install_target, rund, *dirs_to_be_symlinked)