From 2237fcfa8a0634e75cc7beb8f42f1bf095a4578f Mon Sep 17 00:00:00 2001 From: omby8888 <160610297+omby8888@users.noreply.github.com> Date: Mon, 5 Aug 2024 10:21:33 +0300 Subject: [PATCH] [Framework] Not showing misleading error message if port state is empty (#887) # Description What - Not showing misleading error message if port state is empty ## Type of change Please leave one option from the following and delete the rest: - [X] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] New Integration (non-breaking change which adds a new integration) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Non-breaking change (fix of existing functionality that will not change current behavior) - [ ] Documentation (added/updated documentation) ## Screenshots Include screenshots from your environment showing how the resources of the integration will look. ## API Documentation Provide links to the API documentation used for this integration. --- CHANGELOG.md | 7 +++++++ port_ocean/core/integrations/mixins/sync_raw.py | 5 +++-- pyproject.toml | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ab382660a..9e0a059e91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm +## 0.9.11 (2024-08-05) + + +### Bug Fixes + +- Not showing misleading error message if port state is empty + ## 0.9.10 (2024-08-04) diff --git a/port_ocean/core/integrations/mixins/sync_raw.py b/port_ocean/core/integrations/mixins/sync_raw.py index bce005dac3..e71dc61fe4 100644 --- a/port_ocean/core/integrations/mixins/sync_raw.py +++ b/port_ocean/core/integrations/mixins/sync_raw.py @@ -418,6 +418,7 @@ async def sync_raw_all( ) logger.info(f"Resync will use the following mappings: {app_config.dict()}") try: + did_fetched_current_state = True entities_at_port = await ocean.port_client.search_entities( user_agent_type ) @@ -429,7 +430,7 @@ async def sync_raw_all( f"Response status code: {e.response.status_code if isinstance(e, httpx.HTTPStatusError) else None}\n" f"Response content: {e.response.text if isinstance(e, httpx.HTTPStatusError) else None}\n" ) - entities_at_port = [] + did_fetched_current_state = False creation_results: list[tuple[list[Entity], list[Exception]]] = [] @@ -448,7 +449,7 @@ async def sync_raw_all( except asyncio.CancelledError as e: logger.warning("Resync aborted successfully") else: - if not entities_at_port: + if not did_fetched_current_state: logger.warning( "Due to an error before the resync, the previous state of entities at Port is unknown." " Skipping delete phase due to unknown initial state." diff --git a/pyproject.toml b/pyproject.toml index d8aac50e30..a28c43ebf2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "port-ocean" -version = "0.9.10" +version = "0.9.11" description = "Port Ocean is a CLI tool for managing your Port projects." readme = "README.md" homepage = "https://app.getport.io"