qontract-reconcile 0.10.2.dev165__py3-none-any.whl → 0.10.2.dev167__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.4
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev165
3
+ Version: 0.10.2.dev167
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
6
6
  Project-URL: repository, https://github.com/app-sre/qontract-reconcile
@@ -664,7 +664,7 @@ reconcile/utils/state.py,sha256=az4tBmZ0EdbFcAGiBVUxs3cr2-BVWsuDQiNTvjjQq8s,1637
664
664
  reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
665
665
  reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
666
666
  reconcile/utils/terraform_client.py,sha256=IDlrNvGEc2i6ElZIL_fzaJEad1nRC3DkP9_VXhJXmU0,37329
667
- reconcile/utils/terrascript_aws_client.py,sha256=OJm42zVrc0GjVRFHb7SD5ZwHcWI1vAnNRYqeivzeknk,291509
667
+ reconcile/utils/terrascript_aws_client.py,sha256=qQAwDAUK131tm2oBWBJzlKFYtpv7mPkqW1u19-A3wds,292248
668
668
  reconcile/utils/three_way_diff_strategy.py,sha256=oQcHXd9LVhirJfoaOBoHUYuZVGfyL2voKr6KVI34zZE,4833
669
669
  reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
670
670
  reconcile/utils/vault.py,sha256=aSA8l9cJlPUHpChFGl27nSY-Mpq9FMjBo7Dcgb1BVfM,15036
@@ -777,12 +777,12 @@ tools/app_sre_tekton_access_reporter.py,sha256=o9prLUgQpwO3msRWc2as1xT1y9OB3znkp
777
777
  tools/app_sre_tekton_access_revalidation.py,sha256=66nHEaY-bIqxIhpcmwN8AvQZu6ZXenfkg4Fut0pVZRM,2726
778
778
  tools/glitchtip_access_reporter.py,sha256=o01A6b88t3Wie6tj_tJWWVo2J01LxQ_a9giGm4UzEaU,2901
779
779
  tools/glitchtip_access_revalidation.py,sha256=PXN5wxl6OX8sxddPaakDF3X79nFLvpm-lz0mWLVelw0,2806
780
- tools/qontract_cli.py,sha256=VmwXfvYEUewhvTYA3M2ucjRzhCb2G42AWrb9asMsdSQ,157451
780
+ tools/qontract_cli.py,sha256=rmR4aUIghazzRPoxTcKY2YCZWKmYqpvwhS-p-uoeL-4,157549
781
781
  tools/sd_app_sre_alert_report.py,sha256=jQpJdXVID68bSNtJNOGDh0-ei1CfEUS4Itr4MAaBNFA,5062
782
782
  tools/template_validation.py,sha256=qpKYaTgk0GOPGa2Ct5_5sKdwIHtCAKIBGzsMPuJU5fw,3371
783
783
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
784
784
  tools/cli_commands/container_images_report.py,sha256=SXh6sZ1dXXzd-2R5eeBufCtW3J4-Y55--0MZLdo4lr8,5409
785
- tools/cli_commands/erv2.py,sha256=5EekfLBoA0spsdUHrPH47_x7bxxe_q7dTWW7nDw3UxM,23833
785
+ tools/cli_commands/erv2.py,sha256=WJgom7Fe2HuM31QKieYs_3evJuH7DEyd53sV-FKX7PU,26047
786
786
  tools/cli_commands/gpg_encrypt.py,sha256=JWwds_Qg7KhSJMIGUh8TfI5-Jf17iUtmaEi4kWJxfVE,4907
787
787
  tools/cli_commands/systems_and_tools.py,sha256=EMHOF1AtUDaoSk0bbjl6oUKYAz4rTZjIBaF-6E6GspM,16816
788
788
  tools/cli_commands/cost_report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -804,7 +804,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
804
804
  tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
805
805
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
806
806
  tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
807
- qontract_reconcile-0.10.2.dev165.dist-info/METADATA,sha256=plKaiYqaDTQq1ATPumJJ3ElVf4s2-ws0i5NaoBo5Kag,24627
808
- qontract_reconcile-0.10.2.dev165.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
809
- qontract_reconcile-0.10.2.dev165.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
810
- qontract_reconcile-0.10.2.dev165.dist-info/RECORD,,
807
+ qontract_reconcile-0.10.2.dev167.dist-info/METADATA,sha256=gC7vJiajfAcAoktNwpvYbj0FZ0-Lje0pXtytx7-S-Tc,24627
808
+ qontract_reconcile-0.10.2.dev167.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
809
+ qontract_reconcile-0.10.2.dev167.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
810
+ qontract_reconcile-0.10.2.dev167.dist-info/RECORD,,
@@ -6322,6 +6322,22 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
6322
6322
  )
6323
6323
  tf_resources.append(insights_service_account_pool_client_resource)
6324
6324
 
6325
+ # OSD FLEET MANAGER
6326
+ osdfm_service_account_pool_client_resource = aws_cognito_user_pool_client(
6327
+ "osdfm_service_account",
6328
+ name=f"ocm-{identifier}-osdfm-service-account",
6329
+ user_pool_id=f"${{{cognito_user_pool_resource.id}}}",
6330
+ allowed_oauth_scopes=["ocm/OSDFleetManagerService"],
6331
+ depends_on=["aws_cognito_resource_server.userpool_service_resource_server"],
6332
+ **pool_client_service_account_common_args,
6333
+ token_validity_units={
6334
+ "access_token": "minutes",
6335
+ "id_token": "minutes",
6336
+ "refresh_token": "days",
6337
+ },
6338
+ )
6339
+ tf_resources.append(osdfm_service_account_pool_client_resource)
6340
+
6325
6341
  # USER POOL COMPLETE
6326
6342
 
6327
6343
  # rosa-authenticator-vpce provider OR pre-created vpce resources are required for this
@@ -123,6 +123,7 @@ class Erv2Cli:
123
123
  m_inventory.get_from_spec(spec), spec, self._er_settings
124
124
  )
125
125
  )
126
+ self.module_type = m_inventory.get_from_spec(spec).module_type
126
127
  self._resource = f.create_external_resource(spec, self._module_configuration)
127
128
  f.validate_external_resource(self._resource, self._module_configuration)
128
129
 
@@ -221,6 +222,66 @@ class Erv2Cli:
221
222
  print(e.stdout.decode("utf-8"))
222
223
  raise
223
224
 
225
+ def build_terraform(self, credentials: Path) -> None:
226
+ input_file = self.temp / "input.json"
227
+ input_file.write_text(self.input_data)
228
+ tf_module = "tfmodule"
229
+
230
+ # delete previous ERv2 container
231
+ run(["docker", "rm", "-f", "erv2"], capture_output=True, check=True)
232
+
233
+ try:
234
+ with task(self.progress_spinner, "-- Running terraform"):
235
+ run(["docker", "pull", self.image], check=True)
236
+ run(
237
+ [
238
+ "docker",
239
+ "run",
240
+ "--name",
241
+ "erv2",
242
+ "-v",
243
+ f"{input_file!s}:/inputs/input.json:Z",
244
+ "-v",
245
+ f"{credentials!s}:/credentials:Z",
246
+ "-v",
247
+ f"{self.temp}:/work:Z",
248
+ "-e",
249
+ "AWS_SHARED_CREDENTIALS_FILE=/credentials",
250
+ "-e",
251
+ f"TERRAFORM_MODULE_WORK_DIR=/tmp/{tf_module}",
252
+ "-e",
253
+ "LOCAL_STATE=False",
254
+ self.image,
255
+ ],
256
+ check=True,
257
+ capture_output=True,
258
+ )
259
+
260
+ with task(self.progress_spinner, "-- Copying the terraform module"):
261
+ run(
262
+ [
263
+ "docker",
264
+ "cp",
265
+ f"erv2:/tmp/{tf_module}",
266
+ str(self.temp),
267
+ ],
268
+ check=True,
269
+ capture_output=True,
270
+ )
271
+
272
+ # move all assets to local workdir
273
+ src_dir = self.temp / tf_module
274
+ for item in src_dir.iterdir():
275
+ if item.name != ".terraform":
276
+ item.rename(self.temp / item.name)
277
+
278
+ except CalledProcessError as e:
279
+ if e.stderr:
280
+ print(e.stderr.decode("utf-8"))
281
+ if e.stdout:
282
+ print(e.stdout.decode("utf-8"))
283
+ raise
284
+
224
285
  def enter_shell(self, credentials: Path) -> None:
225
286
  """Run the ERv2 container and enter the shell."""
226
287
  input_file = self.temp / "input.json"
tools/qontract_cli.py CHANGED
@@ -4381,8 +4381,10 @@ def migrate(ctx: click.Context, dry_run: bool, skip_build: bool) -> None:
4381
4381
 
4382
4382
  with task(progress, "(erv2) Building the terraform configuration"):
4383
4383
  if not skip_build:
4384
- # build the CDKTF output
4385
- erv2cli.build_cdktf(credentials_file)
4384
+ if erv2cli.module_type == "cdktf":
4385
+ erv2cli.build_cdktf(credentials_file)
4386
+ else:
4387
+ erv2cli.build_terraform(credentials_file)
4386
4388
  erv2_tf_cli = TerraformCli(
4387
4389
  temp_erv2, dry_run=dry_run, progress_spinner=progress
4388
4390
  )