From 8efc72af5ac7e1ec5c00ddb6bcecd658513f53da Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Thu, 7 Mar 2024 11:29:50 +0000 Subject: [PATCH 1/2] Apply CLI clean changes to correct list --- changes.d/6011.fix.md | 2 ++ cylc/flow/option_parsers.py | 4 ++-- tests/unit/test_option_parsers.py | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 changes.d/6011.fix.md diff --git a/changes.d/6011.fix.md b/changes.d/6011.fix.md new file mode 100644 index 00000000000..a518106c850 --- /dev/null +++ b/changes.d/6011.fix.md @@ -0,0 +1,2 @@ +Fix a VIP bug causing remote re-invocation to fail if workflow id +is set explicitly. \ No newline at end of file diff --git a/cylc/flow/option_parsers.py b/cylc/flow/option_parsers.py index 26b7620566c..6402641934e 100644 --- a/cylc/flow/option_parsers.py +++ b/cylc/flow/option_parsers.py @@ -878,9 +878,9 @@ def cleanup_sysargv( new_args[1] = script_name # replace source path with workflow ID. - if str(source) in sys.argv: + if str(source) in new_args: new_args.remove(str(source)) - if workflow_id not in sys.argv: + if workflow_id not in new_args: new_args.append(workflow_id) sys.argv = new_args diff --git a/tests/unit/test_option_parsers.py b/tests/unit/test_option_parsers.py index 05b52badfbe..788aa391389 100644 --- a/tests/unit/test_option_parsers.py +++ b/tests/unit/test_option_parsers.py @@ -383,6 +383,22 @@ def test_combine_options(inputs, expect): 'play --foo something myworkflow'.split(), id='no path given' ), + param( + 'vip -n myworkflow --no-run-name'.split(), + { + 'script_name': 'play', + 'workflow_id': 'myworkflow', + 'compound_script_opts': [ + OptionSettings(['--workflow-name', '-n']), + OptionSettings(['--no-run-name']), + ], + 'script_opts': [ + OptionSettings(['--not-used']), + ] + }, + 'play myworkflow'.split(), + id='workflow-id-added' + ), ] ) def test_cleanup_sysargv(monkeypatch, argv_before, kwargs, expect): From 7c41ee5157945958e33d28f63c7a8728f4e6bbf6 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Wed, 13 Mar 2024 09:55:05 +0000 Subject: [PATCH 2/2] Update changes.d/6011.fix.md Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> --- changes.d/6011.fix.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/changes.d/6011.fix.md b/changes.d/6011.fix.md index a518106c850..89260fdb392 100644 --- a/changes.d/6011.fix.md +++ b/changes.d/6011.fix.md @@ -1,2 +1 @@ -Fix a VIP bug causing remote re-invocation to fail if workflow id -is set explicitly. \ No newline at end of file +Fixed a `cylc vip` bug causing remote re-invocation to fail if using `--workflow-name` option. \ No newline at end of file