qontract-reconcile 0.10.2.dev501__py3-none-any.whl → 0.10.2.dev502__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev501
3
+ Version: 0.10.2.dev502
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
6
6
  Project-URL: repository, https://github.com/app-sre/qontract-reconcile
@@ -98,7 +98,7 @@ reconcile/service_dependencies.py,sha256=KydjllianL0lUwhroBAPui7jrnhHSq7j2PB6CoV
98
98
  reconcile/signalfx_endpoint_monitoring.py,sha256=Nqgsg1cflSd2nNnm89y_e8c--7xLUqTrKOHkDs-qADE,2868
99
99
  reconcile/slack_base.py,sha256=I-msunWxfgu5bSwXYulGbtLjxUB_tRmTCAUCU-3nabI,3484
100
100
  reconcile/slack_usergroups.py,sha256=C36L64wb95tf2tIqJ8T1xXmREpxHvxbhnglk0QOfUVc,30939
101
- reconcile/slack_usergroups_api.py,sha256=4-UJTaGcAatcJADZTfeGlEnFH1vGDc7UL9YMfnav3Mo,24713
101
+ reconcile/slack_usergroups_api.py,sha256=_L0I1CTKVUDxbPksSlTomn4ufBFvs9jnuLsu2FQZBo8,25687
102
102
  reconcile/sql_query.py,sha256=Go_H36p3YTW4Xv-elYDxW_Fe6Q4ErFhD6eQoFh9Jylw,26424
103
103
  reconcile/status.py,sha256=h73oaSxO5sftEGqFrXVAlySBvNYPWpowDaYYplcky5A,565
104
104
  reconcile/status_board.py,sha256=iv2CR3IsX_uDY5aXHjTOySeTR5d3vsABykYNiYNjZew,15316
@@ -764,7 +764,7 @@ reconcile/utils/rosa/session.py,sha256=o7RCTazHRQbDOC_E89qYaQBiHIoj4mfcCjC6ndlA8
764
764
  reconcile/utils/runtime/__init__.py,sha256=sfk92MGfsBh9tKYHl_FH17NdEsrGBwgDFTb7KNKoIfY,107
765
765
  reconcile/utils/runtime/desired_state_diff.py,sha256=Bw4zqel-klXCMZGqD1gyh8zkFq4h5qzv8rJn7K6WTXs,8132
766
766
  reconcile/utils/runtime/environment.py,sha256=rRrj4t11R1JSQO08RcJxkQkyHhRGI8ePo-hjq9Tua1Y,2214
767
- reconcile/utils/runtime/integration.py,sha256=ZvaRX6huhPqlX4wX2GHVwIdoi5kJgdhXMLLlgtyrYnU,14634
767
+ reconcile/utils/runtime/integration.py,sha256=etpSg6D9iqud3mG6UMmovBrRFBWHpjKLW6AUdlu5q5w,15172
768
768
  reconcile/utils/runtime/meta.py,sha256=M_EOxrb0KhQA4TwpHekbog2jOZqaBPVTIijXyRuMjn0,255
769
769
  reconcile/utils/runtime/runner.py,sha256=p7xCT1IDlDz6wKYMDMPOTEdztM4hbcxo0fw9gQf4q-A,9028
770
770
  reconcile/utils/runtime/sharding.py,sha256=r0ieUtNed7NvknSw6qQrCkKpVXE1shuHGnfFcnpA_k4,16142
@@ -817,7 +817,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
817
817
  tools/saas_promotion_state/saas_promotion_state.py,sha256=uQv2QJAmUXP1g2GPIH30WTlvL9soY6m9lefpZEVDM5w,3965
818
818
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
819
819
  tools/sre_checkpoints/util.py,sha256=KcYVfa3UmJHVP_ocgrKe8NkrO5IDB9aWEDydSokPcRk,975
820
- qontract_reconcile-0.10.2.dev501.dist-info/METADATA,sha256=5KI3nXk5biUIU2VnNoJUtQz4jzIspX_1Pfp5SZoGpO4,24958
821
- qontract_reconcile-0.10.2.dev501.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
822
- qontract_reconcile-0.10.2.dev501.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
823
- qontract_reconcile-0.10.2.dev501.dist-info/RECORD,,
820
+ qontract_reconcile-0.10.2.dev502.dist-info/METADATA,sha256=V4uymS3aui-wKLLPkxJciLRiD47I8KWdErfh7XLW5N4,24958
821
+ qontract_reconcile-0.10.2.dev502.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
822
+ qontract_reconcile-0.10.2.dev502.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
823
+ qontract_reconcile-0.10.2.dev502.dist-info/RECORD,,
@@ -49,6 +49,8 @@ from qontract_api_client.api.integrations.slack_usergroups_task_status import (
49
49
  asyncio as slack_usergroups_task_status,
50
50
  )
51
51
  from qontract_api_client.models import (
52
+ SlackUsergroupActionCreate,
53
+ SlackUsergroupActionUpdateMetadata,
52
54
  SlackUsergroupActionUpdateUsers,
53
55
  )
54
56
  from qontract_api_client.models.secret import Secret
@@ -614,6 +616,8 @@ class SlackUsergroupsIntegration(
614
616
  response = await reconcile_slack_usergroups(
615
617
  client=self.qontract_api_client, body=request_data
616
618
  )
619
+ # Always log the request id! It won't be forwarded to #reconcile channel via fluentd filter!
620
+ logging.info(f"request_id: {response.id}")
617
621
  return response
618
622
 
619
623
  async def async_run(self, dry_run: bool) -> None:
@@ -647,6 +651,10 @@ class SlackUsergroupsIntegration(
647
651
 
648
652
  task = await self.reconcile(workspaces=workspaces, dry_run=dry_run)
649
653
 
654
+ # TODO: APPSRE-13196
655
+ # as soon as qontract-api can send event to the #reconcile channel, we don't need to log and wait here
656
+ # for a non-dry-run reconciliation!
657
+
650
658
  # wait for task completion and get the action list
651
659
  task_result = await slack_usergroups_task_status(
652
660
  client=self.qontract_api_client, task_id=task.id, timeout=300
@@ -657,12 +665,21 @@ class SlackUsergroupsIntegration(
657
665
 
658
666
  if task_result.actions:
659
667
  for action in task_result.actions or []:
660
- if isinstance(action, SlackUsergroupActionUpdateUsers):
661
- logging.info(
662
- f"{action.usergroup=} {action.users_to_add=} {action.users_to_remove=}"
663
- )
664
- else:
665
- logging.info(action)
668
+ match action:
669
+ case SlackUsergroupActionUpdateUsers():
670
+ logging.info(
671
+ f"{action.action_type=} {action.usergroup=} {action.users_to_add=} {action.users_to_remove=} total_users={len(action.users)}"
672
+ )
673
+ case SlackUsergroupActionCreate():
674
+ logging.info(
675
+ f"{action.action_type=} {action.usergroup=} {action.users=} {action.description=}"
676
+ )
677
+ case SlackUsergroupActionUpdateMetadata():
678
+ logging.info(
679
+ f"{action.action_type=} {action.usergroup=} {action.channels=} {action.description=}"
680
+ )
681
+ case _:
682
+ logging.info(action)
666
683
 
667
684
  if task_result.errors:
668
685
  logging.error(f"Errors encountered: {len(task_result.errors)}")
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from abc import (
2
3
  ABC,
3
4
  abstractmethod,
@@ -264,12 +265,23 @@ class QontractReconcileApiIntegration[RunParamsTypeVar: RunParams](ABC):
264
265
  Returns the qontract-api client.
265
266
  """
266
267
  config = get_config()
268
+
269
+ # send some envirionment specific information via headers
270
+ environment_headers = {}
271
+ if "BUILD_URL" in os.environ:
272
+ # e.g. https://ci.int.devshift.net/job/service-app-interface-gl-pr-check/643806/
273
+ environment_headers["X-Build-Url"] = os.environ["BUILD_URL"]
274
+ if "gitlabMergeRequestIid" in os.environ:
275
+ # e.g. "643806"
276
+ environment_headers["X-GitLab-MR-ID"] = os.environ["gitlabMergeRequestIid"] # noqa: SIM112
277
+
267
278
  return AuthenticatedClient(
268
279
  base_url=urlparse(config["qontract-api"]["server"]).geturl(),
269
280
  token=config["qontract-api"].get("token", ""),
270
281
  httpx_args={
271
282
  "event_hooks": {"response": [self._raise_on_4xx_5xx]},
272
283
  },
284
+ headers=environment_headers,
273
285
  )
274
286
 
275
287
  @property