qontract-reconcile 0.9.1rc114__py3-none-any.whl → 0.9.1rc115__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.9.1rc114
3
+ Version: 0.9.1rc115
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
@@ -471,7 +471,7 @@ release/test_version.py,sha256=jOMn3Qx-mZC5pnJR0LU9ieIdNaYZSmr1kQ6aCkPngAU,2053
471
471
  release/version.py,sha256=Ud36t9FxGHLubMrE2o5aaaZRGB9_9hU_z0RN9go0TQM,3876
472
472
  tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
473
473
  tools/app_interface_reporter.py,sha256=k3KsYVzBWCxqK8GazjoiaPJGi4f1pMhBtZEoVyIm26s,21850
474
- tools/qontract_cli.py,sha256=bLnkVZ6DrWKxLb1iTlYHOSQ0Dv7k1MSKHnUX6lXHAsU,77774
474
+ tools/qontract_cli.py,sha256=2pgcValVxDA8FnqSEJn2hUn32pdCKSfh0nLotg-Qbuw,77874
475
475
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
476
476
  tools/cli_commands/gpg_encrypt.py,sha256=CghHbzHgnyhBixaklGniltc-_lsoRTNFqqX-TTkbI84,4970
477
477
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
@@ -479,8 +479,8 @@ tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y
479
479
  tools/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
480
480
  tools/test/test_qontract_cli.py,sha256=taXJPi2yJrV5ql6G3IivU3Lj5mNXje-nUEjp6uXa1oc,1396
481
481
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
482
- qontract_reconcile-0.9.1rc114.dist-info/METADATA,sha256=EmpNuAy__Oq93vFdputw2MklxAO6NYKcOQGt3ITqdp8,2257
483
- qontract_reconcile-0.9.1rc114.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
484
- qontract_reconcile-0.9.1rc114.dist-info/entry_points.txt,sha256=3BPvsRryM1C4S_mb5kXmP5AVv-wJBzVCrOJyv6qUmc0,195
485
- qontract_reconcile-0.9.1rc114.dist-info/top_level.txt,sha256=j0CHPIc8TsVRB50wOz_jhxjjaRyCJB3NOQeXhuHS67c,34
486
- qontract_reconcile-0.9.1rc114.dist-info/RECORD,,
482
+ qontract_reconcile-0.9.1rc115.dist-info/METADATA,sha256=GQ9HHNZ1HNjirOw3QtH-dzsPRpXUuBQfL0FF7_du26s,2257
483
+ qontract_reconcile-0.9.1rc115.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
484
+ qontract_reconcile-0.9.1rc115.dist-info/entry_points.txt,sha256=3BPvsRryM1C4S_mb5kXmP5AVv-wJBzVCrOJyv6qUmc0,195
485
+ qontract_reconcile-0.9.1rc115.dist-info/top_level.txt,sha256=j0CHPIc8TsVRB50wOz_jhxjjaRyCJB3NOQeXhuHS67c,34
486
+ qontract_reconcile-0.9.1rc115.dist-info/RECORD,,
tools/qontract_cli.py CHANGED
@@ -7,14 +7,12 @@ import sys
7
7
  from collections import defaultdict
8
8
  from datetime import datetime
9
9
  from operator import itemgetter
10
- from typing import (
11
- Optional,
12
- cast,
13
- )
10
+ from typing import Optional
14
11
 
15
12
  import click
16
13
  import requests
17
14
  import yaml
15
+ from sretoolbox.utils import threaded
18
16
 
19
17
  import reconcile.gitlab_housekeeping as glhk
20
18
  import reconcile.ocm_upgrade_scheduler as ous
@@ -70,10 +68,6 @@ from reconcile.utils.secret_reader import SecretReader
70
68
  from reconcile.utils.semver_helper import parse_semver
71
69
  from reconcile.utils.state import State
72
70
  from reconcile.utils.terraform_client import TerraformClient as Terraform
73
- from reconcile.utils.vault import (
74
- VaultClient,
75
- _VaultClient,
76
- )
77
71
  from tools.cli_commands.gpg_encrypt import (
78
72
  GPGEncryptCommand,
79
73
  GPGEncryptCommandData,
@@ -883,9 +877,11 @@ def clusters_aws_account_ids(ctx):
883
877
  @get.command()
884
878
  @click.pass_context
885
879
  def terraform_users_credentials(ctx) -> None:
886
- vc = cast(_VaultClient, VaultClient())
880
+ settings = queries.get_app_interface_settings()
881
+ accounts = queries.get_state_aws_accounts()
882
+ state = State("account-notifier", accounts, settings=settings)
887
883
 
888
- skip_accounts, appsre_pgp_key, reencrypt_settings = tfu.get_reencrypt_settings()
884
+ skip_accounts, appsre_pgp_key, _ = tfu.get_reencrypt_settings()
889
885
 
890
886
  accounts, working_dirs, _, aws_api = tfu.setup(
891
887
  False,
@@ -919,13 +915,24 @@ def terraform_users_credentials(ctx) -> None:
919
915
  }
920
916
  credentials.append(item)
921
917
 
922
- for secret in vc.list(reencrypt_settings.aws_account_output_vault_path):
923
- secret_request = {
924
- "path": f"{reencrypt_settings.aws_account_output_vault_path}/{secret}"
925
- }
926
- secret_data = vc.read_all(secret_request)
927
- if secret_data["account"] not in skip_accounts:
928
- credentials.append(secret_data)
918
+ secrets = state.ls()
919
+
920
+ def _get_secret(secret_key: str):
921
+ if secret_key.startswith("/output/"):
922
+ secret_data = state.get(secret_key[1:])
923
+ if secret_data["account"] not in skip_accounts:
924
+ return secret_data
925
+ return None
926
+
927
+ secret_result = threaded.run(
928
+ _get_secret,
929
+ secrets,
930
+ 10,
931
+ )
932
+
933
+ for secret in secret_result:
934
+ if secret and secret["account"] not in skip_accounts:
935
+ credentials.append(secret)
929
936
 
930
937
  columns = ["account", "console_url", "user_name", "encrypted_password"]
931
938
  print_output(ctx.obj["options"], credentials, columns)
@@ -933,10 +940,11 @@ def terraform_users_credentials(ctx) -> None:
933
940
 
934
941
  @root.command()
935
942
  @click.argument("account_name")
936
- @click.argument("output_path")
937
943
  @click.pass_context
938
- def user_credentials_migrate_output(ctx, account_name, output_path) -> None:
939
- vc = cast(_VaultClient, VaultClient())
944
+ def user_credentials_migrate_output(ctx, account_name) -> None:
945
+ settings = queries.get_app_interface_settings()
946
+ accounts = queries.get_state_aws_accounts()
947
+ state = State("account-notifier", accounts, settings=settings)
940
948
 
941
949
  skip_accounts, appsre_pgp_key, _ = tfu.get_reencrypt_settings()
942
950
 
@@ -960,24 +968,19 @@ def user_credentials_migrate_output(ctx, account_name, output_path) -> None:
960
968
  )
961
969
  credentials = []
962
970
  for account, output in tf.outputs.items():
963
- if account in skip_accounts:
964
- user_passwords = tf.format_output(output, tf.OUTPUT_TYPE_PASSWORDS)
965
- console_urls = tf.format_output(output, tf.OUTPUT_TYPE_CONSOLEURLS)
966
- for user_name, enc_password in user_passwords.items():
967
- item = {
968
- "account": account,
969
- "console_url": console_urls[account],
970
- "user_name": user_name,
971
- "encrypted_password": enc_password,
972
- }
973
- credentials.append(item)
971
+ user_passwords = tf.format_output(output, tf.OUTPUT_TYPE_PASSWORDS)
972
+ console_urls = tf.format_output(output, tf.OUTPUT_TYPE_CONSOLEURLS)
973
+ for user_name, enc_password in user_passwords.items():
974
+ item = {
975
+ "account": account,
976
+ "console_url": console_urls[account],
977
+ "user_name": user_name,
978
+ "encrypted_password": enc_password,
979
+ }
980
+ credentials.append(item)
974
981
 
975
982
  for cred in credentials:
976
- new_secret = {
977
- "path": f"{output_path}/{cred['user_name']}_{cred['account']}",
978
- "data": cred,
979
- }
980
- vc.write(new_secret, decode_base64=False)
983
+ state.add(f"output/{cred['account']}/{cred['user_name']}", cred)
981
984
 
982
985
 
983
986
  @get.command()