From 45ef34485232da66cafeea8e70b36920f60a1a0f Mon Sep 17 00:00:00 2001 From: dorschw <81086590+dorschw@users.noreply.github.com> Date: Mon, 23 Dec 2024 12:32:46 +0200 Subject: [PATCH 1/4] Improve upload log --- demisto_sdk/commands/upload/uploader.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/demisto_sdk/commands/upload/uploader.py b/demisto_sdk/commands/upload/uploader.py index 78273632987..73502b5751a 100644 --- a/demisto_sdk/commands/upload/uploader.py +++ b/demisto_sdk/commands/upload/uploader.py @@ -452,16 +452,17 @@ def print_summary(self) -> None: for item in self._skipped_upload_marketplace_mismatch ), headers=[ - "NAME", - "TYPE", - "MARKETPLACE", - "FILE_MARKETPLACES", + "Name", + "Type", + "Upload Destination Marketplace", + "Content Marketplace(s)", ], tablefmt="fancy_grid", ) logger.info( - f"SKIPPED UPLOADED DUE TO MARKETPLACE MISMATCH:\n{marketplace_mismatch_str}\n" + f"SKIPPED UPLOADING DUE TO MARKETPLACE MISMATCH:\n{marketplace_mismatch_str}\n" ) + logger.info("Did you forget to specify the marketplace?") if self._failed_upload_version_mismatch: version_mismatch_str = tabulate( From 23efa7b68ad9d1e3818cee74da3f6968a2ee0138 Mon Sep 17 00:00:00 2001 From: dorschw <81086590+dorschw@users.noreply.github.com> Date: Mon, 23 Dec 2024 14:53:27 +0200 Subject: [PATCH 2/4] fix UT, improve text --- demisto_sdk/commands/upload/uploader.py | 4 +++- .../upload_integration_test.py | 23 +++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/demisto_sdk/commands/upload/uploader.py b/demisto_sdk/commands/upload/uploader.py index 73502b5751a..d5fae4ae4c2 100644 --- a/demisto_sdk/commands/upload/uploader.py +++ b/demisto_sdk/commands/upload/uploader.py @@ -447,7 +447,9 @@ def print_summary(self) -> None: item.path.name, item.content_type, self.marketplace, - [marketplace.value for marketplace in item.marketplaces], + ",".join( + [marketplace.value for marketplace in item.marketplaces] + ), ) for item in self._skipped_upload_marketplace_mismatch ), diff --git a/demisto_sdk/tests/integration_tests/upload_integration_test.py b/demisto_sdk/tests/integration_tests/upload_integration_test.py index c9956eb54cb..cbece3dcb8f 100644 --- a/demisto_sdk/tests/integration_tests/upload_integration_test.py +++ b/demisto_sdk/tests/integration_tests/upload_integration_test.py @@ -142,18 +142,17 @@ def test_integration_upload_pack_with_specific_marketplace(demisto_client_mock, ) assert result.exit_code == 0 assert ( - "\n".join( - ( - "SKIPPED UPLOADED DUE TO MARKETPLACE MISMATCH:", - "╒════════════════════════════════════════╤═════════════╤═══════════════╤═════════════════════╕", - "│ NAME │ TYPE │ MARKETPLACE │ FILE_MARKETPLACES │", - "╞════════════════════════════════════════╪═════════════╪═══════════════╪═════════════════════╡", - "│ integration-sample_event_collector.yml │ Integration │ xsoar │ ['marketplacev2'] │", - "╘════════════════════════════════════════╧═════════════╧═══════════════╧═════════════════════╛", - ) - ) - in result.output - ) + """ +SKIPPED UPLOADING DUE TO MARKETPLACE MISMATCH: +╒════════════════════════════════════════╤═════════════╤══════════════════════════════════╤══════════════════════════╕ +│ Name │ Type │ Upload Destination Marketplace │ Content Marketplace(s) │ +╞════════════════════════════════════════╪═════════════╪══════════════════════════════════╪══════════════════════════╡ +│ integration-sample_event_collector.yml │ Integration │ xsoar │ marketplacev2 │ +╘════════════════════════════════════════╧═════════════╧══════════════════════════════════╧══════════════════════════╛ + +Did you forget to specify the marketplace?""" + ) in result.output + assert ( "\n".join( ( From 71a7768244112cb8e504eec6ee5b440fd69b57ec Mon Sep 17 00:00:00 2001 From: dorschw <81086590+dorschw@users.noreply.github.com> Date: Tue, 24 Dec 2024 10:54:55 +0200 Subject: [PATCH 3/4] fix test --- .../upload_integration_test.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/demisto_sdk/tests/integration_tests/upload_integration_test.py b/demisto_sdk/tests/integration_tests/upload_integration_test.py index cbece3dcb8f..da6f3998887 100644 --- a/demisto_sdk/tests/integration_tests/upload_integration_test.py +++ b/demisto_sdk/tests/integration_tests/upload_integration_test.py @@ -141,17 +141,14 @@ def test_integration_upload_pack_with_specific_marketplace(demisto_client_mock, app, [UPLOAD_CMD, "-i", str(pack_path), "--insecure", "--marketplace", "xsoar"] ) assert result.exit_code == 0 + assert "SKIPPED UPLOADING DUE TO MARKETPLACE MISMATCH:" in result.output + assert "Upload Destination Marketplace" in result.output + assert "Content Marketplace(s)" in result.output assert ( - """ -SKIPPED UPLOADING DUE TO MARKETPLACE MISMATCH: -╒════════════════════════════════════════╤═════════════╤══════════════════════════════════╤══════════════════════════╕ -│ Name │ Type │ Upload Destination Marketplace │ Content Marketplace(s) │ -╞════════════════════════════════════════╪═════════════╪══════════════════════════════════╪══════════════════════════╡ -│ integration-sample_event_collector.yml │ Integration │ xsoar │ marketplacev2 │ -╘════════════════════════════════════════╧═════════════╧══════════════════════════════════╧══════════════════════════╛ - -Did you forget to specify the marketplace?""" - ) in result.output + "integration-sample_event_collector.yml │ Integration │ xsoar │ marketplacev2" + in result.output + ) + assert "Did you forget to specify the marketplace?" in result.output assert ( "\n".join( From 1bc98f17e42126249cf75bc5499436ad917eff60 Mon Sep 17 00:00:00 2001 From: dorschw <81086590+dorschw@users.noreply.github.com> Date: Tue, 24 Dec 2024 11:00:08 +0200 Subject: [PATCH 4/4] rn --- .changelog/4727.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .changelog/4727.yml diff --git a/.changelog/4727.yml b/.changelog/4727.yml new file mode 100644 index 00000000000..75e18c2df1c --- /dev/null +++ b/.changelog/4727.yml @@ -0,0 +1,4 @@ +changes: +- description: Fixed an issue where the error message wasn't clear when attempting to upload a content item to an unsupported marketplace. + type: fix +pr_number: 4727