qontract-reconcile 0.10.1rc1135__py3-none-any.whl → 0.10.1rc1137__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.1rc1135
3
+ Version: 0.10.1rc1137
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
@@ -161,7 +161,7 @@ reconcile/aws_version_sync/merge_request_manager/merge_request_manager.py,sha256
161
161
  reconcile/change_owners/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
162
  reconcile/change_owners/approver.py,sha256=Z3_11vnK2WNOxjEEXVDh0224-_-qbt9d6mBeVE-7fsc,2259
163
163
  reconcile/change_owners/bundle.py,sha256=h30fU-JmLH5a-rCAovpzTeTkkkgZztsZ5A2raee0YuU,5355
164
- reconcile/change_owners/change_log_tracking.py,sha256=IEWhegWhdv_r3UfBcHedlJBMpxcdfiTB6nmLB6w5K-s,8882
164
+ reconcile/change_owners/change_log_tracking.py,sha256=JzUmW6m_qg43r0a6WI__YX8-j_ejt1peIy6CkZJfZTg,9049
165
165
  reconcile/change_owners/change_owners.py,sha256=0HRJhDm0oW3uYJFgzynqA1gA0lbhalhSkmWOiQmr-NM,17062
166
166
  reconcile/change_owners/change_types.py,sha256=HEsoBduhcczAXZHwT26mr5sVPxtf8J6tsvjSDDI1ceI,32077
167
167
  reconcile/change_owners/changes.py,sha256=YblT-JPFagctTphzd38SjVmj3k1YsgMzN48zGpnLYKM,18222
@@ -838,7 +838,7 @@ tools/app_interface_metrics_exporter.py,sha256=zkwkxdAUAxjdc-pzx2_oJXG25fo0Fnyd5
838
838
  tools/app_interface_reporter.py,sha256=oZPib4HPq0aZ2Zui1QGJGk6qQdfpeihujGDBnSdKyGE,17627
839
839
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
840
840
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
841
- tools/qontract_cli.py,sha256=sFwwL9GVUXnlxJV4glFKa1T4Q4IjNmgN0rex5aDIRyQ,135492
841
+ tools/qontract_cli.py,sha256=PV2tqOqpFqAQh1_ZGNNf7up4OTBSPZmpGjN7eHxlQ0s,136187
842
842
  tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
843
843
  tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
844
844
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -871,8 +871,8 @@ tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jr
871
871
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
872
872
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
873
873
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
874
- qontract_reconcile-0.10.1rc1135.dist-info/METADATA,sha256=Oak4R7AGZ3502qdMt4vkjhrsP51rNmGLHzAJoQnPqRA,2213
875
- qontract_reconcile-0.10.1rc1135.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
876
- qontract_reconcile-0.10.1rc1135.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
877
- qontract_reconcile-0.10.1rc1135.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
878
- qontract_reconcile-0.10.1rc1135.dist-info/RECORD,,
874
+ qontract_reconcile-0.10.1rc1137.dist-info/METADATA,sha256=7ylXvyDsV2c3I5swlsdqaN4u2wGhqQWkrv6uiGaV67w,2213
875
+ qontract_reconcile-0.10.1rc1137.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
876
+ qontract_reconcile-0.10.1rc1137.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
877
+ qontract_reconcile-0.10.1rc1137.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
878
+ qontract_reconcile-0.10.1rc1137.dist-info/RECORD,,
@@ -167,6 +167,9 @@ class ChangeLogIntegration(QontractReconcileIntegration[ChangeLogIntegrationPara
167
167
  | "/dependencies/jenkins-config-1.yml"
168
168
  | "/dependencies/status-page-component-1.yml"
169
169
  | "/app-sre/app-changelog-1.yml"
170
+ | "/app-sre/slo-document-1.yml"
171
+ | "/app-sre/scorecard-2.yml"
172
+ | "/app-sre/sre-checkpoint-1.yml"
170
173
  ):
171
174
  for c in change_versions:
172
175
  c_app: dict[str, str] = c["app"]
tools/qontract_cli.py CHANGED
@@ -1377,8 +1377,13 @@ def aws_creds(ctx, account_name):
1377
1377
  @click.argument("src")
1378
1378
  @click.argument("dest")
1379
1379
  @click.argument("region", required=False, default="us-east-1")
1380
+ @click.option(
1381
+ "--force/--no-force",
1382
+ help="Force the copy even if a statefile already exists at the destination",
1383
+ default=False,
1384
+ )
1380
1385
  @click.pass_context
1381
- def copy_tfstate(ctx, account_name, bucket, src, dest, region):
1386
+ def copy_tfstate(ctx, account_name, bucket, src, dest, region, force):
1382
1387
  """copy a manually managed terraform state file to the correct location expected by
1383
1388
  the terraform-repo integration.
1384
1389
 
@@ -1409,15 +1414,32 @@ def copy_tfstate(ctx, account_name, bucket, src, dest, region):
1409
1414
  dest_bucket = account["terraformState"]["bucket"]
1410
1415
 
1411
1416
  with AWSApi(1, accounts, settings, secret_reader) as aws:
1412
- prompt_text = f"Are you sure you want to copy 's3://{bucket}/{src}' to 's3://{dest_bucket}/{dest_key}'? This will overwrite any object currently at the destination path."
1413
- if click.confirm(prompt_text):
1414
- session = aws.get_session(account_name)
1415
- s3_client = aws.get_session_client(session, "s3", region)
1416
- copy_source = {
1417
- "Bucket": bucket,
1418
- "Key": src,
1419
- }
1417
+ session = aws.get_session(account_name)
1418
+ s3_client = aws.get_session_client(session, "s3", region)
1419
+ copy_source = {
1420
+ "Bucket": bucket,
1421
+ "Key": src,
1422
+ }
1420
1423
 
1424
+ dest_pretty_path = f"s3://{dest_bucket}/{dest_key}"
1425
+ # check if dest already exists
1426
+ response = s3_client.list_objects_v2(
1427
+ Bucket=dest_bucket, Prefix=dest_key, MaxKeys=1
1428
+ )
1429
+
1430
+ if "Contents" in response:
1431
+ if force:
1432
+ logging.warning(
1433
+ f"Existing object at '{dest_pretty_path}' will be overwritten as --force is set"
1434
+ )
1435
+ else:
1436
+ logging.error(
1437
+ f"Will not overwrite existing object at '{dest_pretty_path}'. Use --force to overwrite the destination object"
1438
+ )
1439
+ return
1440
+
1441
+ prompt_text = f"Are you sure you want to copy 's3://{bucket}/{src}' to '{dest_pretty_path}'?"
1442
+ if click.confirm(prompt_text):
1421
1443
  s3_client.copy(copy_source, dest_bucket, dest_key)
1422
1444
  logging.info("successfully copied the statefile to the new location")
1423
1445