qontract-reconcile 0.10.1rc934__py3-none-any.whl → 0.10.1rc935__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.1rc934
3
+ Version: 0.10.1rc935
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
@@ -466,7 +466,7 @@ reconcile/templating/validator.py,sha256=5f9f35PCHOOdjb7KZquL2YdabyuAUokPDa4xutS
466
466
  reconcile/templating/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
467
467
  reconcile/templating/lib/merge_request_manager.py,sha256=P4IbblzXbubjlaxAYoahHFADUNIXLepfqwzdnHPs8OY,5608
468
468
  reconcile/templating/lib/model.py,sha256=Y1PeEP-koHKiH46JSwv4-PGRGQtcxZa9VmjTiuI6Lxs,889
469
- reconcile/templating/lib/rendering.py,sha256=6kt8NCCwB4vLKYal7KtRmBDguIC1p_PIQCRr-vL7p5w,5504
469
+ reconcile/templating/lib/rendering.py,sha256=pbZv8uYlNtgzTjYMl5qSIW94vDS4CfE47aSjX4HpL-k,6210
470
470
  reconcile/terraform_init/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
471
471
  reconcile/terraform_init/integration.py,sha256=glQ9uy8Kj2aTQXCAupwSFeih7reX_xMX_UuWW_ywBMU,6100
472
472
  reconcile/terraform_init/merge_request.py,sha256=3CYtgSd7Q9zjKg4wsDz437EPCRfGeZZ8fZ0Y-ChKXJY,1475
@@ -842,8 +842,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
842
842
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
843
843
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
844
844
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
845
- qontract_reconcile-0.10.1rc934.dist-info/METADATA,sha256=micYrUXFTKVnAM62FPDfNksiAyTEuVfwUTxRSWnAhKk,2262
846
- qontract_reconcile-0.10.1rc934.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
847
- qontract_reconcile-0.10.1rc934.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
848
- qontract_reconcile-0.10.1rc934.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
849
- qontract_reconcile-0.10.1rc934.dist-info/RECORD,,
845
+ qontract_reconcile-0.10.1rc935.dist-info/METADATA,sha256=nG4Alh2q6Ov9z5xVFf0kauA15MoWAQNm-Cc-C8bNA1Y,2262
846
+ qontract_reconcile-0.10.1rc935.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
847
+ qontract_reconcile-0.10.1rc935.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
848
+ qontract_reconcile-0.10.1rc935.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
849
+ qontract_reconcile-0.10.1rc935.dist-info/RECORD,,
@@ -123,11 +123,28 @@ class PatchRenderer(Renderer):
123
123
  )
124
124
 
125
125
  if isinstance(matched_value, list):
126
- if not self.template.patch.identifier:
127
- raise ValueError(
128
- f"Expected identifier in patch for list at {self.template}"
129
- )
130
- dta_identifier = data_to_add.get(self.template.patch.identifier)
126
+
127
+ def get_identifier(data: dict[str, Any]) -> Any:
128
+ assert self.template.patch is not None # mypy
129
+ if not self.template.patch.identifier:
130
+ raise ValueError(
131
+ f"Expected identifier in patch for list at {self.template}"
132
+ )
133
+ if self.template.patch.identifier.startswith(
134
+ "$"
135
+ ) and not self.template.patch.identifier.startswith("$ref"):
136
+ # jsonpath and list of strings support
137
+ if matches := [
138
+ match.value
139
+ for match in parse_jsonpath(
140
+ self.template.patch.identifier
141
+ ).find(data)
142
+ ]:
143
+ return matches[0]
144
+ return None
145
+ return data.get(self.template.patch.identifier)
146
+
147
+ dta_identifier = get_identifier(data_to_add)
131
148
  if not dta_identifier:
132
149
  raise ValueError(
133
150
  f"Expected identifier {self.template.patch.identifier} in data to add"
@@ -137,7 +154,7 @@ class PatchRenderer(Renderer):
137
154
  (
138
155
  index
139
156
  for index, data in enumerate(matched_value)
140
- if data.get(self.template.patch.identifier) == dta_identifier
157
+ if get_identifier(data) == dta_identifier
141
158
  ),
142
159
  None,
143
160
  )