qontract-reconcile 0.10.1rc980__py3-none-any.whl → 0.10.1rc982__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.1rc980
3
+ Version: 0.10.1rc982
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
@@ -665,7 +665,7 @@ reconcile/utils/gitlab_api.py,sha256=WfhLhOp3-cOwgptiCNPhWja74Lo41ZIlJ6HFSWaIDRw
665
665
  reconcile/utils/gpg.py,sha256=EKG7_fdMv8BMlV5yUdPiqoTx-KrzmVSEAl2sLkaKwWI,1123
666
666
  reconcile/utils/gql.py,sha256=NqxosFCInLy_dF_fcXnRYcZgsThedSyv_I3U8k2SLMg,14161
667
667
  reconcile/utils/grouping.py,sha256=vr9SFHZ7bqmHYrvYcEZt-Er3-yQYfAAdq5sHLZVmXPY,456
668
- reconcile/utils/helm.py,sha256=QpT8jxnA8VY0-tDU45LusB4Fzv22hlxxA0lH0G9_9Fk,2773
668
+ reconcile/utils/helm.py,sha256=LuxRvL-N9tOWdluphk_B_Ulwuk2nWYcD_RzZcI-hY2A,3373
669
669
  reconcile/utils/helpers.py,sha256=k9svgFFZG7H5FvHYY0g5jJyvgvh2UDZxf0Ib221teag,1179
670
670
  reconcile/utils/imap_client.py,sha256=h8YDiCSCvroErhpH_-KGYI7Y2WU2Q2oSpuxDFbOkSbY,1989
671
671
  reconcile/utils/instrumented_wrappers.py,sha256=eVwMoa6FCrYxLv3RML3WpZF9qKVfCTjMxphgVXG03OM,1073
@@ -693,7 +693,7 @@ reconcile/utils/pagerduty_api.py,sha256=_24i9S_4X7nlvHb-7clXRE0p1BG4ODjOzKxWO-F9
693
693
  reconcile/utils/parse_dhms_duration.py,sha256=TONpLnec5gHeF7k815YNJpQyDjXhkxZIcv9s8ffbTSY,1840
694
694
  reconcile/utils/password_validator.py,sha256=XwuWg-8CPlcuG7dl_oQ1G1h2gSVSnfMym_VkuprpWVg,2183
695
695
  reconcile/utils/prometheus.py,sha256=Ad0rwLbxRuuYjHwkwJloHEdK0bvy42h-p-HIT1DhDhs,3832
696
- reconcile/utils/promotion_state.py,sha256=drkR0PSzfsUVPB0pisARzvUfHgk8KPbeK4FUZdP099Y,3894
696
+ reconcile/utils/promotion_state.py,sha256=McSgGj3oog83ThJCrMR2v8q6Xb_Pxij-HEe_RbDu8cg,3946
697
697
  reconcile/utils/promtool.py,sha256=UmBfTHgW9Ys7fZ9BfhIVJEFGLkbge9y1AgL5PNHp7iA,2831
698
698
  reconcile/utils/quay_api.py,sha256=wyPD9F1do0FsAcmIr7RejUOs4zaKs8-OUylxI3MLk8A,7860
699
699
  reconcile/utils/raw_github_api.py,sha256=O6Q4vq7bi5ZWcfquPutc9rJ4Ef8_sFqd_RLgzpIoj0w,2920
@@ -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.1rc980.dist-info/METADATA,sha256=P-UqVuzizwNTstf7_YiCVv-LPydPyyoGVYV_Bcdl-Oc,2262
855
- qontract_reconcile-0.10.1rc980.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
856
- qontract_reconcile-0.10.1rc980.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
857
- qontract_reconcile-0.10.1rc980.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
858
- qontract_reconcile-0.10.1rc980.dist-info/RECORD,,
854
+ qontract_reconcile-0.10.1rc982.dist-info/METADATA,sha256=wOB0k60EKCZ43HHIbjLgVg-jByLkqU3oxnVMeD6k95A,2262
855
+ qontract_reconcile-0.10.1rc982.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
856
+ qontract_reconcile-0.10.1rc982.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
857
+ qontract_reconcile-0.10.1rc982.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
858
+ qontract_reconcile-0.10.1rc982.dist-info/RECORD,,
reconcile/utils/helm.py CHANGED
@@ -31,39 +31,52 @@ def do_template(
31
31
  name: str,
32
32
  ) -> str:
33
33
  try:
34
- with open(os.path.join(path, "Chart.yaml"), encoding="locale") as chart_file:
35
- chart = yaml.safe_load(chart_file)
36
- if dependencies := chart.get("dependencies"):
37
- for dep in dependencies:
38
- if repo := dep.get("repository"):
39
- cmd = [
40
- "helm",
41
- "repo",
42
- "add",
43
- dep["name"],
44
- repo,
45
- ]
46
- run(cmd, capture_output=False, check=True)
34
+ with tempfile.NamedTemporaryFile(
35
+ mode="w+", encoding="locale"
36
+ ) as repositories_file:
37
+ with open(
38
+ os.path.join(path, "Chart.yaml"), encoding="locale"
39
+ ) as chart_file:
40
+ chart = yaml.safe_load(chart_file)
41
+ if dependencies := chart.get("dependencies"):
42
+ for dep in dependencies:
43
+ if repo := dep.get("repository"):
44
+ cmd = [
45
+ "helm",
46
+ "repo",
47
+ "add",
48
+ dep["name"],
49
+ repo,
50
+ "--repository-config",
51
+ repositories_file.name,
52
+ ]
53
+ run(cmd, capture_output=False, check=True)
54
+ cmd = [
55
+ "helm",
56
+ "dependency",
57
+ "build",
58
+ path,
59
+ "--repository-config",
60
+ repositories_file.name,
61
+ ]
62
+ run(cmd, capture_output=False, check=True)
63
+ with tempfile.NamedTemporaryFile(
64
+ mode="w+", encoding="locale"
65
+ ) as values_file:
66
+ values_file.write(json.dumps(values, cls=JSONEncoder))
67
+ values_file.flush()
47
68
  cmd = [
48
69
  "helm",
49
- "dependency",
50
- "build",
70
+ "template",
51
71
  path,
72
+ "-n",
73
+ name,
74
+ "-f",
75
+ values_file.name,
76
+ "--repository-config",
77
+ repositories_file.name,
52
78
  ]
53
- run(cmd, capture_output=False, check=True)
54
- with tempfile.NamedTemporaryFile(mode="w+", encoding="locale") as values_file:
55
- values_file.write(json.dumps(values, cls=JSONEncoder))
56
- values_file.flush()
57
- cmd = [
58
- "helm",
59
- "template",
60
- path,
61
- "-n",
62
- name,
63
- "-f",
64
- values_file.name,
65
- ]
66
- result = run(cmd, capture_output=True, check=True)
79
+ result = run(cmd, capture_output=True, check=True)
67
80
  except CalledProcessError as e:
68
81
  msg = f'Error running helm template [{" ".join(cmd)}]'
69
82
  if e.stdout:
@@ -95,7 +95,10 @@ class PromotionState:
95
95
  if use_cache and path_v2 in self._promotion_data_cache:
96
96
  return self._promotion_data_cache[path_v2]
97
97
 
98
- data = self._state.get(path_v2)
98
+ data = self._state.get(path_v2, None)
99
+ if not data:
100
+ return None
101
+
99
102
  promotion_data = PromotionData(**data)
100
103
  self._promotion_data_cache[path_v2] = promotion_data
101
104
  return promotion_data