diff --git a/pubtools-marketplacesvm-wrapper/marketplacesvm_push_wrapper.py b/pubtools-marketplacesvm-wrapper/marketplacesvm_push_wrapper.py index 339b0fd..c25a034 100755 --- a/pubtools-marketplacesvm-wrapper/marketplacesvm_push_wrapper.py +++ b/pubtools-marketplacesvm-wrapper/marketplacesvm_push_wrapper.py @@ -71,7 +71,7 @@ def parse_args(): def get_source_url(stagedirs): for item in stagedirs: - if not re.match(r"^/[^,]{0,4000}\/*starmap\/*$", item): + if not re.match(r"^/(\w++\/*)+$", item): raise ValueError("Not a valid staging directory: %s" % item) return f"staged:{','.join(stagedirs)}" @@ -82,7 +82,7 @@ def settings_to_args(parsed): "starmap_file": "--repo-file", "source": "", } - out = [] + out = ["--offline"] # The "offline" arg is used to prevent invoking a StArMap server if parsed.nochannel: out.append("--pre-push") diff --git a/pubtools-marketplacesvm-wrapper/test_marketplacesvm_push_wrapper.py b/pubtools-marketplacesvm-wrapper/test_marketplacesvm_push_wrapper.py index a6d4d0a..8987304 100644 --- a/pubtools-marketplacesvm-wrapper/test_marketplacesvm_push_wrapper.py +++ b/pubtools-marketplacesvm-wrapper/test_marketplacesvm_push_wrapper.py @@ -45,7 +45,7 @@ def test_dry_run(caplog, mock_mkt_env_vars): assert "This is a dry-run!" in caplog.messages assert ( "Would have run: pubtools-marketplacesvm-marketplace-push " - "--repo-file mapping.yaml " + "--offline --repo-file mapping.yaml " "staged:/test1/starmap,/test2/starmap" ) in caplog.messages @@ -68,13 +68,14 @@ def test_basic_command(mock_run, caplog, mock_mkt_env_vars): assert "This is a dry-run!" not in caplog.messages assert ( "Running pubtools-marketplacesvm-marketplace-push " - "--repo-file mapping.yaml " + "--offline --repo-file mapping.yaml " "staged:/test1/starmap,/test2/starmap" ) in caplog.messages mock_run.assert_called_once_with( [ "pubtools-marketplacesvm-marketplace-push", + "--offline", "--repo-file", "mapping.yaml", "staged:/test1/starmap,/test2/starmap", @@ -102,13 +103,14 @@ def test_basic_command_nochannel(mock_run, caplog, mock_mkt_env_vars): assert "This is a dry-run!" not in caplog.messages assert ( "Running pubtools-marketplacesvm-marketplace-push " - "--pre-push --repo-file mapping.yaml " + "--offline --pre-push --repo-file mapping.yaml " "staged:/test1/starmap,/test2/starmap" ) in caplog.messages mock_run.assert_called_once_with( [ "pubtools-marketplacesvm-marketplace-push", + "--offline", "--pre-push", "--repo-file", "mapping.yaml", @@ -121,9 +123,9 @@ def test_basic_command_nochannel(mock_run, caplog, mock_mkt_env_vars): @pytest.mark.parametrize( "stageddirs", [ - ["/foo/bar/starmap"], - ["/starmap/", "/tmp/starmap/"], - ["/a/b/c/d/e/f/g/h/i/starmap", "/a1/a2/a3/starmap/", "/starmap"], + ["/foo/bar/"], + ["/a", "/tmp/foo/"], + ["/a/b/c/d/e/f/g/h/i", "/a1/a2/a3/", "/f"], ], ) def test_get_source_url(stageddirs): @@ -134,12 +136,7 @@ def test_get_source_url(stageddirs): @pytest.mark.parametrize( "stageddirs", - [ - ["/"], - ["/foo/bar"], - ["/some/staged/dir"], - ["/starmap/another_dir"], - ], + [["foo"], ["foo/bar"], ["//////////"], [r"/\/\/\/\/\/\/"]], ) def test_get_source_url_invalid(stageddirs): err = "Not a valid staging directory:"