berryworld 1.0.0.195389__py3-none-any.whl → 1.0.0.195805__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,5 +1,7 @@
1
+ import os
1
2
  import ast
2
3
  import yaml
4
+ import json
3
5
  from .handy_mix import HandyMix
4
6
  from azure.identity import ClientSecretCredential
5
7
  from azure.keyvault.secrets import SecretClient
@@ -8,6 +10,12 @@ from azure.keyvault.secrets import SecretClient
8
10
  class EnvVariables:
9
11
  """ Generate the environmental variables to be used by kubernetes """
10
12
 
13
+ def __init__(self, env):
14
+ """
15
+ :param env: Environment folder to upload the terraform .tfvars file generated
16
+ """
17
+ self.env = env
18
+
11
19
  def extract_akv_config_from_tf(self, config_path):
12
20
  """ Extract the AKV configuration from the Terraform file
13
21
  :param config_path: Path to the Terraform file
@@ -60,6 +68,9 @@ class EnvVariables:
60
68
 
61
69
  secrets = {}
62
70
  for prop in client.list_properties_of_secrets():
71
+ if not prop.enabled:
72
+ continue
73
+
63
74
  if prop.tags:
64
75
  if any("project" in key and value in project_tags for key, value in prop.tags.items()):
65
76
  secret = client.get_secret(prop.name)
@@ -80,6 +91,14 @@ class EnvVariables:
80
91
  for key, value in secrets.items():
81
92
  f.write(f"{key}={value}\n")
82
93
 
94
+ # Create .env file for container apps
95
+ if os.name != "nt":
96
+ # Linux/Mac: generate terraform .tfvars file
97
+ tfvars_path = f"./environments/{self.env}/secrets.auto.tfvars.json"
98
+ os.makedirs(os.path.dirname(tfvars_path), exist_ok=True)
99
+ with open(tfvars_path, "w") as f:
100
+ json.dump({"keyvault_secrets": secrets}, f, indent=2)
101
+
83
102
  def generate_env_tf(self, config_path='./environments/prod/step01.tf', env_path='.env'):
84
103
  """ Main function to parse arguments and generate AKV environment variables file.
85
104
  :param config_path: Path to the Terraform configuration file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: berryworld
3
- Version: 1.0.0.195389
3
+ Version: 1.0.0.195805
4
4
  Summary: Handy classes to improve ETL processes
5
5
  Home-page: https://www.berryworld.com
6
6
  Author: BerryWorld ltd
@@ -8,7 +8,7 @@ berryworld/credentials.py,sha256=oyBvdf0q6KrofONGWIhLDTcIIon0pkA0vGOyI_dt8AE,664
8
8
  berryworld/devops.py,sha256=7mRbyZPGzk5ox-6J2etv3NxCcfP4cprG0_Xelh7prn8,9776
9
9
  berryworld/email_con.py,sha256=CVyEDVnc_iVeRTwJgIU31ToFgyix7L2yn4Ih9Wu7I5s,15806
10
10
  berryworld/email_logging.py,sha256=LeSrTExhQhar49gJR2wGC1dS0lqsNpFl9pS3eYWqnuo,4936
11
- berryworld/generate_env.py,sha256=B-d4Tu5M69j4CFfQjby3kNXxndIJhb4O9H-v94L6iwI,11204
11
+ berryworld/generate_env.py,sha256=lQn4tmRuEmaRfJuDOSYCQuRqxFyAKtnKEvJiYacN7LY,11845
12
12
  berryworld/handy_mix.py,sha256=ZPr5Z4l5TfyXQjhuLjttGi90whBooTQhB7M-Lq5L1DQ,10683
13
13
  berryworld/logging.py,sha256=tOxzaFALQm3aVVEc3I7t8MU6PwgUI9VSnzNCH9yRryo,1013
14
14
  berryworld/logic_apps.py,sha256=a0uU4tNO3v2w7grdBv-OOx4hUf7VBIerJpwZ9U-29dQ,14591
@@ -26,12 +26,12 @@ berryworld/verify_keys.py,sha256=X7VUHqYDklWPDO0bGVHIOXeLq5Qi4fZRZbHYw5x7UnA,435
26
26
  berryworld/vivantio.py,sha256=QfZo0UKqkzVRg_LyiwivNd3aEup4TH57x4KxLZkCJwc,10627
27
27
  berryworld/vivantio_logging.py,sha256=ciy7gA4u3FrgUIpEBnMgocbNPp6jcu9TPoy-kLcrTZU,5736
28
28
  berryworld/xml_parser.py,sha256=HWD71NaTN3DaIOGT6Wzxs4CEsroFhGQwe9iPLIL80Co,957
29
- berryworld-1.0.0.195389.dist-info/licenses/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
29
+ berryworld-1.0.0.195805.dist-info/licenses/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
30
30
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  tests/test_allocation_config.py,sha256=e12l6fE9U57eSPS35g6ekJ_hol7-RHg89JV60_m1BlE,4633
32
32
  tests/test_handy_mix_config.py,sha256=Un56mz9KJmdn4K4OwzHAHLSRzDU1Xv2nFrONNuzOG04,2594
33
33
  tests/test_xml_parser.py,sha256=3QTlhFEd6KbK6nRFKZnc35tad6wqukTbe4QrFi8mr_8,859
34
- berryworld-1.0.0.195389.dist-info/METADATA,sha256=pJ8cdlkkGJEqjyquaLZUJaK5_OfHPcReyBL5hcPuTbI,1445
35
- berryworld-1.0.0.195389.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- berryworld-1.0.0.195389.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
37
- berryworld-1.0.0.195389.dist-info/RECORD,,
34
+ berryworld-1.0.0.195805.dist-info/METADATA,sha256=cIAamgWVRDwwpoyu7jVkFhkC6pzfRd4jpQbLDbiUdOE,1445
35
+ berryworld-1.0.0.195805.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ berryworld-1.0.0.195805.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
37
+ berryworld-1.0.0.195805.dist-info/RECORD,,