qontract-reconcile 0.10.1rc1129__py3-none-any.whl → 0.10.1rc1131__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.1rc1129
3
+ Version: 0.10.1rc1131
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
@@ -140,7 +140,7 @@ reconcile/aus/version_gates/ocp_gate_handler.py,sha256=RW1ppDaCZXVegV9AzzqYXxDUu
140
140
  reconcile/aus/version_gates/sts_version_gate_handler.py,sha256=swwwz0YyvrEBf_InqrRRBCt2QzHYNvvq8jz9aYwElh4,3663
141
141
  reconcile/aws_account_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
142
142
  reconcile/aws_account_manager/integration.py,sha256=WOE_mi45pvJW4TNKh4mCGSViJiElH--T4Wg0CLMYxpY,14988
143
- reconcile/aws_account_manager/merge_request_manager.py,sha256=eLRf7D6j9sPvJh3xpYRkrckleGrZcr6J0aED7xmNbXI,3815
143
+ reconcile/aws_account_manager/merge_request_manager.py,sha256=fz9s1VrBGHi0MdUR9D1Pqo7Q2lHlzbgzgYEE4kEYm9s,3950
144
144
  reconcile/aws_account_manager/metrics.py,sha256=YB10ea4kIGwJfs5N14RF-RoXPb-QQWaDBz1jLZ3YWE0,917
145
145
  reconcile/aws_account_manager/reconciler.py,sha256=8mwwcWVVNoUzmttzxgnLyePqN823v1t_dQCNCrx1mG0,15035
146
146
  reconcile/aws_account_manager/utils.py,sha256=iYPPOtbZ7FiKkz9v5f1YXRIHw5YFOtSavUkF8oMwfJY,1439
@@ -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=_OqTpZ57TGdWR_0Oc9sT83JVilLKbAz5NbPm1EyL34I,133385
841
+ tools/qontract_cli.py,sha256=sFwwL9GVUXnlxJV4glFKa1T4Q4IjNmgN0rex5aDIRyQ,135492
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.1rc1129.dist-info/METADATA,sha256=Z1h9eqAPOgiPFSvnkYjuHeRDc1Xe5s3E1tX1VHVx1sc,2213
875
- qontract_reconcile-0.10.1rc1129.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
876
- qontract_reconcile-0.10.1rc1129.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
877
- qontract_reconcile-0.10.1rc1129.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
878
- qontract_reconcile-0.10.1rc1129.dist-info/RECORD,,
874
+ qontract_reconcile-0.10.1rc1131.dist-info/METADATA,sha256=2COkT03GzJzpy3Gb1O-srsEwA9GQwzaBMm00k4pPxOI,2213
875
+ qontract_reconcile-0.10.1rc1131.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
876
+ qontract_reconcile-0.10.1rc1131.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
877
+ qontract_reconcile-0.10.1rc1131.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
878
+ qontract_reconcile-0.10.1rc1131.dist-info/RECORD,,
@@ -88,10 +88,12 @@ class MergeRequestManager:
88
88
  self._vcs.get_file_content_from_app_interface_master(
89
89
  file_path=account_tmpl_file_path
90
90
  )
91
- # File already exists
92
- raise FileExistsError(
93
- f"File {account_tmpl_file_path} already exists in the repository"
91
+ # File already exists. nothing to do.
92
+ logging.debug(
93
+ "The template collection file %s already exists. This may happen if the MR has been merged but template-renderer isn't running yet.",
94
+ account_tmpl_file_path,
94
95
  )
96
+ return
95
97
  except GitlabGetError as e:
96
98
  if e.response_code != 404:
97
99
  raise e
tools/qontract_cli.py CHANGED
@@ -1371,6 +1371,57 @@ def aws_creds(ctx, account_name):
1371
1371
  print(f"export AWS_SECRET_ACCESS_KEY={secret['aws_secret_access_key']}")
1372
1372
 
1373
1373
 
1374
+ @root.command()
1375
+ @click.argument("account_name")
1376
+ @click.argument("bucket")
1377
+ @click.argument("src")
1378
+ @click.argument("dest")
1379
+ @click.argument("region", required=False, default="us-east-1")
1380
+ @click.pass_context
1381
+ def copy_tfstate(ctx, account_name, bucket, src, dest, region):
1382
+ """copy a manually managed terraform state file to the correct location expected by
1383
+ the terraform-repo integration.
1384
+
1385
+ SRC should include the full filename including the extension
1386
+
1387
+ DEST should include the filename without extension.
1388
+ """
1389
+ settings = queries.get_app_interface_settings()
1390
+ secret_reader = SecretReader(settings=settings)
1391
+ accounts = queries.get_aws_accounts(name=account_name, terraform_state=True)
1392
+ if not accounts:
1393
+ print(f"{account_name} not found.")
1394
+ sys.exit(1)
1395
+ account = accounts[0]
1396
+
1397
+ state_key = [
1398
+ i
1399
+ for i in account["terraformState"]["integrations"]
1400
+ if i["integration"] == "terraform-repo"
1401
+ ]
1402
+ if len(state_key) == 0:
1403
+ logging.error(
1404
+ "terraform-repo is missing a section in this account's '/dependencies/terraform-state-1.yml' file, please add one using the docs in https://gitlab.cee.redhat.com/service/app-interface/-/blob/master/docs/terraform-repo/sop/migrating-existing-state.md?ref_type=heads and then try again"
1405
+ )
1406
+ return
1407
+
1408
+ dest_key = f"{state_key[0]['key']}/{dest}-tf-repo.tfstate"
1409
+ dest_bucket = account["terraformState"]["bucket"]
1410
+
1411
+ 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
+ }
1420
+
1421
+ s3_client.copy(copy_source, dest_bucket, dest_key)
1422
+ logging.info("successfully copied the statefile to the new location")
1423
+
1424
+
1374
1425
  @get.command(short_help='obtain "rosa create cluster" command by cluster name')
1375
1426
  @click.argument("cluster_name")
1376
1427
  @click.pass_context