qontract-reconcile 0.10.1rc1179__py3-none-any.whl → 0.10.1rc1180__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.1rc1179
3
+ Version: 0.10.1rc1180
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
@@ -112,7 +112,7 @@ reconcile/terraform_aws_route53.py,sha256=dQzzT46YhwRA902_H6pi-f7WlX4EaH187wXSdm
112
112
  reconcile/terraform_cloudflare_dns.py,sha256=-aLEe2QnH5cJPu7HWqs-R9NmQ1NlFbcVUm0v7alVL3I,13431
113
113
  reconcile/terraform_cloudflare_resources.py,sha256=pq8Ieo5NmB-dYQ9X2F0s6iEoINMzhiqGw2yQK4ovok4,14980
114
114
  reconcile/terraform_cloudflare_users.py,sha256=iyTG5sj20Jg4J4qWJ144KVptfIHGOSfH8wQKxu0imq0,13942
115
- reconcile/terraform_repo.py,sha256=TKqlodhQGoAtQ6nDm04TNlpx4wpgJ_n4atoUK5Rfd7o,16444
115
+ reconcile/terraform_repo.py,sha256=jT8zD-V1_5D6yB2gLYP1nEC9wHoHktDQYnJqpo2EC9M,15807
116
116
  reconcile/terraform_resources.py,sha256=iufjMJs_aSEvmh7Cg11beCxKmV8nrOLOpEtiTryPNx0,19470
117
117
  reconcile/terraform_tgw_attachments.py,sha256=09svJG9pAiwWp4aY0xRoQRV90T4ZNwHG3r8flI-ZS_s,18810
118
118
  reconcile/terraform_users.py,sha256=HqSm3ev3b8dZ9J6F_phDZB-FQsnlsdeKp9RPoY1cU94,10188
@@ -566,7 +566,7 @@ reconcile/test/test_terraform_aws_route53.py,sha256=xHggb8K1P76OyCfFcogbkmyKle-N
566
566
  reconcile/test/test_terraform_cloudflare_dns.py,sha256=aQTXX8Vr4h9aWvJZTnpZEhMGYoBpT2d45ZxU_ECIQ6o,3425
567
567
  reconcile/test/test_terraform_cloudflare_resources.py,sha256=1mdSZS-38mtTSg7teJgDCJU1b_yKbwnrr3N5m8kwV4k,13595
568
568
  reconcile/test/test_terraform_cloudflare_users.py,sha256=2VGBtMUhckLPtUnQlHIzpGsCnyVJZPNLFf-ABELkxbQ,27456
569
- reconcile/test/test_terraform_repo.py,sha256=Th6MNbexZX-pTtEpYFiXX0cMAZfnuFcYQ71ZZSjumbE,13025
569
+ reconcile/test/test_terraform_repo.py,sha256=r6bwryHtq6-VuUh3fuMsxlsjbQAgrcQUHOEFou_hilQ,12260
570
570
  reconcile/test/test_terraform_resources.py,sha256=8C97yXIEihaQ3DZrtjxLNt4y4G12IOhD01ydm7JjliY,15359
571
571
  reconcile/test/test_terraform_tgw_attachments.py,sha256=pJFmQzUwAn-wKpF6oSkImpdF7WXvcky8iaJiXbjGGgU,41104
572
572
  reconcile/test/test_terraform_users.py,sha256=XOAfGvITCJPI1LTlISmHbA4ONMQMkxYUMTsny7pQCFw,4319
@@ -880,8 +880,8 @@ tools/test/test_qontract_cli.py,sha256=iuzKbQ6ahinvjoQmQLBrG4shey0z-1rB6qCgS8T6d
880
880
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
881
881
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
882
882
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
883
- qontract_reconcile-0.10.1rc1179.dist-info/METADATA,sha256=TrEzA9ztxHZUkVWE9KPoeEMIg_cEtRmS-JDoLYPzeHo,2213
884
- qontract_reconcile-0.10.1rc1179.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
885
- qontract_reconcile-0.10.1rc1179.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
886
- qontract_reconcile-0.10.1rc1179.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
887
- qontract_reconcile-0.10.1rc1179.dist-info/RECORD,,
883
+ qontract_reconcile-0.10.1rc1180.dist-info/METADATA,sha256=5FtpxYHIFj662mfS5_AXkrDYRFw4uWWBGxXElRlLS24,2213
884
+ qontract_reconcile-0.10.1rc1180.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
885
+ qontract_reconcile-0.10.1rc1180.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
886
+ qontract_reconcile-0.10.1rc1180.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
887
+ qontract_reconcile-0.10.1rc1180.dist-info/RECORD,,
@@ -100,7 +100,6 @@ class TerraformRepoIntegration(
100
100
  desired_state=desired,
101
101
  dry_run=dry_run,
102
102
  state=state,
103
- recreate_state=False,
104
103
  )
105
104
 
106
105
  if repo_diff_result:
@@ -110,18 +109,19 @@ class TerraformRepoIntegration(
110
109
  # the existing state stored in S3. This is due to a behavior in Pydantic V1 that has since been addressed in V2
111
110
  # https://docs.pydantic.dev/latest/blog/pydantic-v2/#required-vs-nullable-cleanup
112
111
  # so in this case, tf-repo will just recreate all of those state files in S3 and not actually do a plan or apply
113
- logging.error(err)
114
- logging.info(
115
- "Unable to parse existing Terraform-Repo state from S3. Note that this is separate from the actual .tfstate files. Terraform Repo will re-create its own state upon merge and will not update any infrastructure. This typically occurs with changes to the Terraform Repo schema files and is normally resolved once state is re-created."
112
+ logging.warning(
113
+ "Unable to parse existing Terraform-Repo state from S3. Will re-create internal state upon apply, more info here: https://gitlab.cee.redhat.com/service/app-interface/-/blob/master/docs/terraform-repo/sop/statefile-load-errors.md",
114
+ exc_info=err,
116
115
  )
117
116
  repo_diff_result = self.calculate_diff(
118
117
  existing_state=[],
119
118
  desired_state=desired,
120
119
  dry_run=dry_run,
121
120
  state=state,
122
- recreate_state=True,
123
121
  )
124
122
 
123
+ # we don't call print_output here meaning that the executor will not plan/apply
124
+
125
125
  def print_output(self, diff: list[TerraformRepoV1], dry_run: bool) -> OutputFile:
126
126
  """Parses and prints the output of a Terraform Repo diff for the executor
127
127
 
@@ -302,7 +302,6 @@ class TerraformRepoIntegration(
302
302
  desired_state: list[TerraformRepoV1],
303
303
  dry_run: bool,
304
304
  state: State | None,
305
- recreate_state: bool,
306
305
  ) -> list[TerraformRepoV1] | None:
307
306
  """Calculated the difference between existing and desired state
308
307
  to determine what actions the executor will need to take
@@ -315,8 +314,6 @@ class TerraformRepoIntegration(
315
314
  :type dry_run: bool
316
315
  :param state: AWS S3 state
317
316
  :type state: Optional[State]
318
- :param recreate_state: whether we are recreating our own state
319
- :type recreate_state: bool
320
317
  :raises ParameterError: if there is an invalid operation performed like trying to delete
321
318
  a representation in A-I before setting the delete flag
322
319
  :return: the terraform repo to act on
@@ -326,13 +323,6 @@ class TerraformRepoIntegration(
326
323
 
327
324
  merged = self.merge_results(diff)
328
325
 
329
- # validate that only one repo is being modified in each MR
330
- # this lets us fail early and avoid multiple GL requests we don't need to make
331
- if dry_run and len(merged) > 1 and not recreate_state:
332
- raise Exception(
333
- "Only one repository can be modified per merge request, please split your change out into multiple MRs. Hint: try rebasing your merge request"
334
- )
335
-
336
326
  # added repos: do standard validation that SHA is valid
337
327
  if self.params.validate_git:
338
328
  for add_repo in diff.add.values():
@@ -193,7 +193,6 @@ def test_addition_to_existing_repo(existing_repo, new_repo, int_params, state_mo
193
193
  desired_state=desired,
194
194
  dry_run=False,
195
195
  state=state_mock,
196
- recreate_state=False,
197
196
  )
198
197
 
199
198
  assert diff == [new_repo]
@@ -215,7 +214,6 @@ def test_updating_repo_ref(existing_repo, int_params, state_mock):
215
214
  desired_state=[updated_repo],
216
215
  dry_run=False,
217
216
  state=state_mock,
218
- recreate_state=False,
219
217
  )
220
218
 
221
219
  assert diff == [updated_repo]
@@ -236,7 +234,6 @@ def test_force_rerun(existing_repo, int_params, state_mock):
236
234
  desired_state=[updated_repo],
237
235
  dry_run=False,
238
236
  state=state_mock,
239
- recreate_state=False,
240
237
  )
241
238
 
242
239
  assert diff == [updated_repo]
@@ -263,7 +260,6 @@ def test_fail_on_update_invalid_repo_params(existing_repo, int_params):
263
260
  desired_state=[updated_repo],
264
261
  dry_run=True,
265
262
  state=None,
266
- recreate_state=False,
267
263
  )
268
264
 
269
265
 
@@ -279,7 +275,6 @@ def test_delete_repo(existing_repo, int_params, state_mock):
279
275
  desired_state=[updated_repo],
280
276
  dry_run=False,
281
277
  state=state_mock,
282
- recreate_state=False,
283
278
  )
284
279
 
285
280
  assert diff == [updated_repo]
@@ -298,7 +293,6 @@ def test_delete_repo_without_flag(existing_repo, int_params):
298
293
  desired_state=[],
299
294
  dry_run=True,
300
295
  state=None,
301
- recreate_state=False,
302
296
  )
303
297
 
304
298
 
@@ -361,7 +355,6 @@ def test_update_repo_state(int_params, existing_repo, state_mock):
361
355
  desired_state=desired_state,
362
356
  dry_run=False,
363
357
  state=state_mock,
364
- recreate_state=False,
365
358
  )
366
359
 
367
360
  state_mock.add.assert_called_once_with(
@@ -384,7 +377,6 @@ def test_output_correct_statefile(
384
377
  desired_state=desired_state,
385
378
  dry_run=True,
386
379
  state=state_mock,
387
- recreate_state=False,
388
380
  )
389
381
 
390
382
  assert diff
@@ -406,7 +398,6 @@ def test_output_correct_no_statefile(
406
398
  desired_state=desired_state,
407
399
  dry_run=True,
408
400
  state=state_mock,
409
- recreate_state=False,
410
401
  )
411
402
 
412
403
  assert diff
@@ -415,21 +406,6 @@ def test_output_correct_no_statefile(
415
406
  assert new_repo_output == current_output
416
407
 
417
408
 
418
- def test_fail_on_multiple_repos_dry_run(int_params, existing_repo, new_repo):
419
- integration = TerraformRepoIntegration(params=int_params)
420
-
421
- desired_state = [existing_repo, new_repo]
422
-
423
- with pytest.raises(Exception):
424
- integration.calculate_diff(
425
- existing_state=[],
426
- desired_state=desired_state,
427
- dry_run=True,
428
- state=None,
429
- recreate_state=False,
430
- )
431
-
432
-
433
409
  def test_succeed_on_multiple_repos_non_dry_run(int_params, existing_repo, new_repo):
434
410
  integration = TerraformRepoIntegration(params=int_params)
435
411
 
@@ -440,7 +416,6 @@ def test_succeed_on_multiple_repos_non_dry_run(int_params, existing_repo, new_re
440
416
  desired_state=desired_state,
441
417
  dry_run=False,
442
418
  state=None,
443
- recreate_state=False,
444
419
  )
445
420
 
446
421
  assert diff
@@ -460,7 +435,6 @@ def test_no_op_succeeds(int_params, existing_repo):
460
435
  desired_state=state,
461
436
  dry_run=True,
462
437
  state=None,
463
- recreate_state=False,
464
438
  )
465
439
 
466
440
  assert diff is None