port-ocean 0.20.0__py3-none-any.whl → 0.20.2__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,6 +13,7 @@ if TYPE_CHECKING:
13
13
  from port_ocean.core.handlers.port_app_config.models import PortAppConfig
14
14
 
15
15
 
16
+ ORG_USE_PROVISIONED_DEFAULTS_FEATURE_FLAG = "USE_PROVISIONED_DEFAULTS"
16
17
  INTEGRATION_POLLING_INTERVAL_INITIAL_SECONDS = 3
17
18
  INTEGRATION_POLLING_INTERVAL_BACKOFF_FACTOR = 1.55
18
19
  INTEGRATION_POLLING_RETRY_LIMIT = 30
@@ -68,21 +69,26 @@ class IntegrationClientMixin:
68
69
  return response
69
70
 
70
71
  async def get_current_integration(
71
- self, should_raise: bool = True, should_log: bool = True
72
+ self,
73
+ should_raise: bool = True,
74
+ should_log: bool = True,
75
+ has_provision_feature_flag: bool = False,
72
76
  ) -> dict[str, Any]:
73
77
  response = await self._get_current_integration()
74
78
  handle_status_code(response, should_raise, should_log)
75
79
  integration = response.json().get("integration", {})
76
80
  if integration.get("config", None) or not integration:
77
81
  return integration
78
- is_provision_enabled_for_integration = integration.get(
79
- "installationAppType", None
80
- ) and (
81
- await self.is_integration_provision_enabled(
82
- integration.get("installationAppType", ""),
83
- should_raise,
84
- should_log,
82
+ is_provision_enabled_for_integration = (
83
+ integration.get("installationAppType", None)
84
+ and (
85
+ await self.is_integration_provision_enabled(
86
+ integration.get("installationAppType", ""),
87
+ should_raise,
88
+ should_log,
89
+ )
85
90
  )
91
+ and has_provision_feature_flag
86
92
  )
87
93
 
88
94
  if is_provision_enabled_for_integration:
@@ -58,11 +58,14 @@ async def _initialize_required_integration_settings(
58
58
  port_client: PortClient,
59
59
  integration_config: IntegrationConfiguration,
60
60
  default_mapping: PortAppConfig | None = None,
61
+ has_provision_feature_flag: bool = False,
61
62
  ) -> None:
62
63
  try:
63
64
  logger.info("Initializing integration at port")
64
65
  integration = await port_client.get_current_integration(
65
- should_log=False, should_raise=False
66
+ should_log=False,
67
+ should_raise=False,
68
+ has_provision_feature_flag=has_provision_feature_flag,
66
69
  )
67
70
  if not integration:
68
71
  logger.info(
@@ -219,6 +222,10 @@ async def _initialize_defaults(
219
222
  )
220
223
  )
221
224
 
225
+ has_provision_feature_flag = ORG_USE_PROVISIONED_DEFAULTS_FEATURE_FLAG in (
226
+ await port_client.get_organization_feature_flags()
227
+ )
228
+
222
229
  if (
223
230
  not integration_config.create_port_resources_origin
224
231
  and is_integration_provision_enabled
@@ -236,11 +243,7 @@ async def _initialize_defaults(
236
243
  logger.info(
237
244
  "Resources origin is set to be Port, verifying integration is supported"
238
245
  )
239
- org_feature_flags = await port_client.get_organization_feature_flags()
240
- if (
241
- not is_integration_provision_enabled
242
- or ORG_USE_PROVISIONED_DEFAULTS_FEATURE_FLAG not in org_feature_flags
243
- ):
246
+ if not is_integration_provision_enabled or not has_provision_feature_flag:
244
247
  logger.info(
245
248
  "Port origin for Integration is not supported, changing resources origin to use Ocean"
246
249
  )
@@ -265,6 +268,7 @@ async def _initialize_defaults(
265
268
  port_client,
266
269
  integration_config,
267
270
  defaults.port_app_config if defaults else None,
271
+ has_provision_feature_flag=has_provision_feature_flag,
268
272
  )
269
273
 
270
274
  if (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: port-ocean
3
- Version: 0.20.0
3
+ Version: 0.20.2
4
4
  Summary: Port Ocean is a CLI tool for managing your Port projects.
5
5
  Home-page: https://app.getport.io
6
6
  Keywords: ocean,port-ocean,port
@@ -53,7 +53,7 @@ port_ocean/clients/port/client.py,sha256=OaNeN3U7Hw0tK4jYE6ESJEPKbTf9nGp2jcJVq00
53
53
  port_ocean/clients/port/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  port_ocean/clients/port/mixins/blueprints.py,sha256=POBl4uDocrgJBw4rvCAzwRcD4jk-uBL6pDAuKMTajdg,4633
55
55
  port_ocean/clients/port/mixins/entities.py,sha256=PJzVZTBW_OheFRGPRCZ6yPbVGEAKsMO9CNDNJUI1l48,10770
56
- port_ocean/clients/port/mixins/integrations.py,sha256=0ht8nfjsRBu_dbnlMZxSH0jqKv0PF8U8EkllRXgnrWA,9122
56
+ port_ocean/clients/port/mixins/integrations.py,sha256=nqz1gvQnR6Nzv62ZfbXEyli7FTKW5DCFpI1x1KoJJ_E,9341
57
57
  port_ocean/clients/port/mixins/migrations.py,sha256=A6896oJF6WbFL2WroyTkMzr12yhVyWqGoq9dtLNSKBY,1457
58
58
  port_ocean/clients/port/mixins/organization.py,sha256=fCo_ZS8UlQXsyIx-odTuWkbnfcYmVnQfIsSyJuPOPjM,1031
59
59
  port_ocean/clients/port/retry_transport.py,sha256=PtIZOAZ6V-ncpVysRUsPOgt8Sf01QLnTKB5YeKBxkJk,1861
@@ -73,7 +73,7 @@ port_ocean/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
73
  port_ocean/core/defaults/__init__.py,sha256=8qCZg8n06WAdMu9s_FiRtDYLGPGHbOuS60vapeUoAks,142
74
74
  port_ocean/core/defaults/clean.py,sha256=_rL-NCl6Q_x3lUxDW5ACOM27IYilTCWl6ISUfRleuL0,2891
75
75
  port_ocean/core/defaults/common.py,sha256=zJsj7jvlqIMLGXhdASUlbKS8GIAf-FDKKB0O7jB6nx0,4166
76
- port_ocean/core/defaults/initialize.py,sha256=3Ezn63YwxVnByegRPqNXt057Tx9D0IxqrZQHgkrbKWA,10760
76
+ port_ocean/core/defaults/initialize.py,sha256=8BYtPTRj6UGAwP15VBzdRzhtrJOUi88gumrXBX2aG0k,10948
77
77
  port_ocean/core/event_listener/__init__.py,sha256=T3E52MKs79fNEW381p7zU9F2vOMvIiiTYWlqRUqnsg0,1135
78
78
  port_ocean/core/event_listener/base.py,sha256=VdIdp7RLOSxH3ICyV-wCD3NiJoUzsh2KkJ0a9B29GeI,2847
79
79
  port_ocean/core/event_listener/factory.py,sha256=M4Qi05pI840sjDIbdjUEgYe9Gp5ckoCkX-KgLBxUpZg,4096
@@ -184,8 +184,8 @@ port_ocean/utils/repeat.py,sha256=U2OeCkHPWXmRTVoPV-VcJRlQhcYqPWI5NfmPlb1JIbc,32
184
184
  port_ocean/utils/signal.py,sha256=mMVq-1Ab5YpNiqN4PkiyTGlV_G0wkUDMMjTZp5z3pb0,1514
185
185
  port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
186
186
  port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
187
- port_ocean-0.20.0.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
188
- port_ocean-0.20.0.dist-info/METADATA,sha256=X2MxnIa5HHfiETogtSckUoMZWkCGlOyBpemPDuqQLfs,6669
189
- port_ocean-0.20.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
190
- port_ocean-0.20.0.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
191
- port_ocean-0.20.0.dist-info/RECORD,,
187
+ port_ocean-0.20.2.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
188
+ port_ocean-0.20.2.dist-info/METADATA,sha256=XxZ-m-APGcoVMvquiras63hlMmE2A5qoyC5efcBFXc0,6669
189
+ port_ocean-0.20.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
190
+ port_ocean-0.20.2.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
191
+ port_ocean-0.20.2.dist-info/RECORD,,