qontract-reconcile 0.10.1rc973__py3-none-any.whl → 0.10.1rc974__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.1
2
2
  Name: qontract-reconcile
3
- Version: 0.10.1rc973
3
+ Version: 0.10.1rc974
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Home-page: https://github.com/app-sre/qontract-reconcile
6
6
  Author: Red Hat App-SRE Team
@@ -316,7 +316,7 @@ reconcile/gql_definitions/glitchtip/glitchtip_project.py,sha256=AojrkCDGbVjY0TOk
316
316
  reconcile/gql_definitions/glitchtip_project_alerts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
317
317
  reconcile/gql_definitions/glitchtip_project_alerts/glitchtip_project.py,sha256=Pv6RcuIzpNmGc43eEq64nnKG0Dr7H0wjy5Xg1_oRltM,5197
318
318
  reconcile/gql_definitions/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
319
- reconcile/gql_definitions/integrations/integrations.py,sha256=LfpgVbCCCk20ohwP5pDea5fwxMFGrcgE6J_WHBuGqek,11595
319
+ reconcile/gql_definitions/integrations/integrations.py,sha256=HosEgRUlAkxLNoj2cnq3mrTdWDn9UvbNmtz6OcweIYk,11668
320
320
  reconcile/gql_definitions/jenkins_configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
321
321
  reconcile/gql_definitions/jenkins_configs/jenkins_configs.py,sha256=0nMkH0G-AjQwu53fqHykth6X6jjbHdW2hBp5n7N-r24,2766
322
322
  reconcile/gql_definitions/jenkins_configs/jenkins_instances.py,sha256=b3gYVzQavxeLe4jSM5ZxrO77Vvs7kOljVOXEkTO943U,2165
@@ -820,7 +820,7 @@ tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5
820
820
  tools/app_interface_reporter.py,sha256=uy9eRHf6EdvD8ZY2WYdroGXm18DOdnqVZyxaWN3Bm_0,17724
821
821
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
822
822
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
823
- tools/qontract_cli.py,sha256=XPna9b9Khpj81uJJBL6KIHhIPYoDKeMi5jBuNTNGGrM,124486
823
+ tools/qontract_cli.py,sha256=S5oiRXYf_k47ovhoB4RIF7ysgqzaBp3CooTqBKg21mg,126061
824
824
  tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
825
825
  tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
826
826
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -851,8 +851,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
851
851
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
852
852
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
853
853
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
854
- qontract_reconcile-0.10.1rc973.dist-info/METADATA,sha256=jMbfD4v2wrIGbDyj0IGF1KOlLZUXYLxJBKmIbmhwAPw,2262
855
- qontract_reconcile-0.10.1rc973.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
856
- qontract_reconcile-0.10.1rc973.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
857
- qontract_reconcile-0.10.1rc973.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
858
- qontract_reconcile-0.10.1rc973.dist-info/RECORD,,
854
+ qontract_reconcile-0.10.1rc974.dist-info/METADATA,sha256=94eluuqiBo17X4lkF_9R7aWCwxh250QExPnHgaFnazU,2262
855
+ qontract_reconcile-0.10.1rc974.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
856
+ qontract_reconcile-0.10.1rc974.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
857
+ qontract_reconcile-0.10.1rc974.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
858
+ qontract_reconcile-0.10.1rc974.dist-info/RECORD,,
@@ -72,6 +72,7 @@ query Integrations {
72
72
  }
73
73
  cluster {
74
74
  name
75
+ labels
75
76
  serverUrl
76
77
  insecureSkipTLSVerify
77
78
  jumpHost {
@@ -210,6 +211,7 @@ class EnvironmentV1(ConfiguredBaseModel):
210
211
 
211
212
  class ClusterV1(ConfiguredBaseModel):
212
213
  name: str = Field(..., alias="name")
214
+ labels: Optional[Json] = Field(..., alias="labels")
213
215
  server_url: str = Field(..., alias="serverUrl")
214
216
  insecure_skip_tls_verify: Optional[bool] = Field(..., alias="insecureSkipTLSVerify")
215
217
  jump_host: Optional[CommonJumphostFields] = Field(..., alias="jumpHost")
tools/qontract_cli.py CHANGED
@@ -71,6 +71,7 @@ from reconcile.gql_definitions.common.app_interface_vault_settings import (
71
71
  AppInterfaceSettingsV1,
72
72
  )
73
73
  from reconcile.gql_definitions.fragments.aus_organization import AUSOCMOrganization
74
+ from reconcile.gql_definitions.integrations import integrations as integrations_gql
74
75
  from reconcile.gql_definitions.maintenance import maintenances as maintenances_gql
75
76
  from reconcile.jenkins_job_builder import init_jjb
76
77
  from reconcile.slack_base import slackapi_from_queries
@@ -2728,6 +2729,49 @@ def systems_and_tools(ctx):
2728
2729
  print_output(ctx.obj["options"], inventory.data, inventory.columns)
2729
2730
 
2730
2731
 
2732
+ @get.command(short_help="get integration logs")
2733
+ @click.argument("integration_name")
2734
+ @click.option(
2735
+ "--environment_name", default="production", help="environment to get logs from"
2736
+ )
2737
+ @click.pass_context
2738
+ def logs(ctx, integration_name: str, environment_name: str):
2739
+ integrations = [
2740
+ i
2741
+ for i in integrations_gql.query(query_func=gql.get_api().query).integrations
2742
+ or []
2743
+ if i.name == integration_name
2744
+ ]
2745
+ if not integrations:
2746
+ print("integration not found")
2747
+ return
2748
+ integration = integrations[0]
2749
+ vault_settings = get_app_interface_vault_settings()
2750
+ secret_reader = create_secret_reader(use_vault=vault_settings.vault)
2751
+ managed = integration.managed
2752
+ if not managed:
2753
+ print("integration is not managed")
2754
+ return
2755
+ namespaces = [
2756
+ m.namespace
2757
+ for m in managed
2758
+ if m.namespace.cluster.labels
2759
+ and m.namespace.cluster.labels.get("environment") == environment_name
2760
+ ]
2761
+ if not namespaces:
2762
+ print(f"no managed {environment_name} namespace found")
2763
+ return
2764
+ namespace = namespaces[0]
2765
+ cluster = namespaces[0].cluster
2766
+ if not cluster.automation_token:
2767
+ print("cluster automation token not found")
2768
+ return
2769
+ token = secret_reader.read_secret(cluster.automation_token)
2770
+
2771
+ command = f"oc --server {cluster.server_url} --token {token} --namespace {namespace.name} logs -c int -l app=qontract-reconcile-{integration.name}"
2772
+ print(command)
2773
+
2774
+
2731
2775
  @get.command
2732
2776
  @click.pass_context
2733
2777
  def jenkins_jobs(ctx):