tgwrap 0.8.11__py3-none-any.whl → 0.8.12__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.
- tgwrap/deploy.py +54 -51
- tgwrap/main.py +5 -1
- {tgwrap-0.8.11.dist-info → tgwrap-0.8.12.dist-info}/METADATA +4 -2
- tgwrap-0.8.12.dist-info/RECORD +11 -0
- tgwrap-0.8.11.dist-info/RECORD +0 -11
- {tgwrap-0.8.11.dist-info → tgwrap-0.8.12.dist-info}/LICENSE +0 -0
- {tgwrap-0.8.11.dist-info → tgwrap-0.8.12.dist-info}/WHEEL +0 -0
- {tgwrap-0.8.11.dist-info → tgwrap-0.8.12.dist-info}/entry_points.txt +0 -0
tgwrap/deploy.py
CHANGED
@@ -171,66 +171,69 @@ def prepare_deploy_config(step, config, source_dir, source_config_dir, target_di
|
|
171
171
|
printer.warning(f'Source path of config file does not exist: {source_path}')
|
172
172
|
|
173
173
|
for ss, substack in substack_configs:
|
174
|
-
|
175
|
-
|
176
|
-
source_path = os.path.join(
|
177
|
-
source_dir, source_stage, substack['source'], ''
|
178
|
-
)
|
179
|
-
target_path = os.path.join(
|
180
|
-
target_dir, substack['target'], ''
|
181
|
-
)
|
182
|
-
|
183
|
-
include_modules = substack['include_modules'] if len(substack.get('include_modules', {})) > 0 else []
|
184
|
-
printer.verbose(f'Include modules: {include_modules}')
|
185
|
-
|
186
|
-
if include_modules:
|
187
|
-
# get all directories in the substack and create an exlude_modules list from that
|
188
|
-
source_directories = get_directories(source_path)
|
189
|
-
exclude_modules = list(set(source_directories) - set(include_modules))
|
190
|
-
else:
|
191
|
-
exclude_modules = substack.get('exclude_modules', [])
|
192
|
-
|
193
|
-
if os.path.exists(source_path):
|
194
|
-
deploy_actions[f'substack -> {substack["target"]}'] = {
|
195
|
-
"source": source_path,
|
196
|
-
"target": target_path,
|
197
|
-
"excludes": exclude_modules,
|
198
|
-
}
|
174
|
+
if 'applies_to_stages' in substack and target_stage not in substack['applies_to_stages']:
|
175
|
+
printer.verbose(f'Target stage {target_stage} not applicable for substack {ss}.')
|
199
176
|
else:
|
200
|
-
printer.
|
201
|
-
|
202
|
-
if len(substack.get('configs', [])) > 0:
|
203
|
-
# run some checks and sets some variables
|
204
|
-
if not source_config_dir:
|
205
|
-
raise Exception("Config files must be deployed but 'config_path' variable is not set!")
|
206
|
-
elif not config_dir:
|
207
|
-
raise Exception("Config files must be deployed but 'config_dir' variable is not set!")
|
177
|
+
printer.verbose(f'Found substack : {ss}')
|
208
178
|
|
179
|
+
source_path = os.path.join(
|
180
|
+
source_dir, source_stage, substack['source'], ''
|
181
|
+
)
|
209
182
|
target_path = os.path.join(
|
210
|
-
target_dir,
|
183
|
+
target_dir, substack['target'], ''
|
211
184
|
)
|
212
|
-
# the target path might not exist
|
213
|
-
try:
|
214
|
-
os.makedirs(target_path)
|
215
|
-
except FileExistsError:
|
216
|
-
pass
|
217
185
|
|
218
|
-
|
219
|
-
printer.verbose(f'
|
186
|
+
include_modules = substack['include_modules'] if len(substack.get('include_modules', {})) > 0 else []
|
187
|
+
printer.verbose(f'Include modules: {include_modules}')
|
220
188
|
|
221
|
-
|
222
|
-
|
223
|
-
)
|
189
|
+
if include_modules:
|
190
|
+
# get all directories in the substack and create an exlude_modules list from that
|
191
|
+
source_directories = get_directories(source_path)
|
192
|
+
exclude_modules = list(set(source_directories) - set(include_modules))
|
193
|
+
else:
|
194
|
+
exclude_modules = substack.get('exclude_modules', [])
|
224
195
|
|
225
|
-
full_target_path = os.path.dirname(os.path.join(target_path, cfg))
|
226
|
-
# print("source: ", full_source_path)
|
227
|
-
# print("target: ", full_target_path)
|
228
196
|
if os.path.exists(source_path):
|
229
|
-
deploy_actions[f
|
230
|
-
"source":
|
231
|
-
"target":
|
197
|
+
deploy_actions[f'substack -> {substack["target"]}'] = {
|
198
|
+
"source": source_path,
|
199
|
+
"target": target_path,
|
200
|
+
"excludes": exclude_modules,
|
232
201
|
}
|
233
202
|
else:
|
234
|
-
printer.warning(f'Source path of
|
203
|
+
printer.warning(f'Source path of substack does not exist: {source_path}')
|
204
|
+
|
205
|
+
if len(substack.get('configs', [])) > 0:
|
206
|
+
# run some checks and sets some variables
|
207
|
+
if not source_config_dir:
|
208
|
+
raise Exception("Config files must be deployed but 'config_path' variable is not set!")
|
209
|
+
elif not config_dir:
|
210
|
+
raise Exception("Config files must be deployed but 'config_dir' variable is not set!")
|
211
|
+
|
212
|
+
target_path = os.path.join(
|
213
|
+
target_dir, config_dir, module_name, target_stage, substack['target'], '',
|
214
|
+
)
|
215
|
+
# the target path might not exist
|
216
|
+
try:
|
217
|
+
os.makedirs(target_path)
|
218
|
+
except FileExistsError:
|
219
|
+
pass
|
220
|
+
|
221
|
+
for cfg in substack.get('configs', []):
|
222
|
+
printer.verbose(f'Found substack config file : {cfg}')
|
223
|
+
|
224
|
+
full_source_path = os.path.join(
|
225
|
+
source_config_dir, source_stage, substack['source'], cfg
|
226
|
+
)
|
227
|
+
|
228
|
+
full_target_path = os.path.dirname(os.path.join(target_path, cfg))
|
229
|
+
# print("source: ", full_source_path)
|
230
|
+
# print("target: ", full_target_path)
|
231
|
+
if os.path.exists(source_path):
|
232
|
+
deploy_actions[f"substack {substack['target']} configs -> {os.path.join(substack['source'], cfg)}"] = {
|
233
|
+
"source": full_source_path,
|
234
|
+
"target": full_target_path,
|
235
|
+
}
|
236
|
+
else:
|
237
|
+
printer.warning(f'Source path of config file does not exist: {source_path}')
|
235
238
|
|
236
239
|
return deploy_actions
|
tgwrap/main.py
CHANGED
@@ -1314,6 +1314,10 @@ class TgWrap():
|
|
1314
1314
|
# and make it unique
|
1315
1315
|
substacks = set(substacks)
|
1316
1316
|
|
1317
|
+
# the manifest file supports both `sub_stacks` and `substack` config name. Annoying to be a bit autistic when it comes to naming :-/
|
1318
|
+
substack_configs = manifest.get('sub_stacks', {})
|
1319
|
+
substack_configs.update(manifest.get('substacks', {}))
|
1320
|
+
|
1317
1321
|
for target_stage in target_stages:
|
1318
1322
|
target_dir = os.path.join(working_dir, '', target_stage)
|
1319
1323
|
self.printer.header(f'Deploy stage {target_stage} to {target_dir}...')
|
@@ -1337,7 +1341,7 @@ class TgWrap():
|
|
1337
1341
|
target_dir=target_dir,
|
1338
1342
|
target_stage=target_stage,
|
1339
1343
|
substacks=substacks,
|
1340
|
-
substack_configs=
|
1344
|
+
substack_configs=substack_configs.items(),
|
1341
1345
|
tg_file_name=self.TERRAGRUNT_FILE,
|
1342
1346
|
verbose=self.printer.print_verbose,
|
1343
1347
|
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tgwrap
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.12
|
4
4
|
Summary: A (terragrunt) wrapper around a (terraform) wrapper around ....
|
5
5
|
Home-page: https://gitlab.com/lunadata/tgwrap
|
6
6
|
License: MIT
|
@@ -230,7 +230,7 @@ deploy: # which modules do you want to deploy
|
|
230
230
|
# - source: networking
|
231
231
|
# - target: networking-connected
|
232
232
|
|
233
|
-
|
233
|
+
substacks:
|
234
234
|
is01:
|
235
235
|
source: shared-integration/intsvc01
|
236
236
|
target: integration/is01
|
@@ -240,6 +240,8 @@ sub_stacks:
|
|
240
240
|
- my-ss-config.hcl
|
241
241
|
- ../my-ss-config-dir
|
242
242
|
is02:
|
243
|
+
applies_to_stages: # optional list of stages to include the substack in
|
244
|
+
- dev
|
243
245
|
source: shared-integration/intsvc01
|
244
246
|
target: integration/is02
|
245
247
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
tgwrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
tgwrap/analyze.py,sha256=CsSaGv-be6ATy36z9X7x00gpKY59soJys2VbIzD-tmg,8726
|
3
|
+
tgwrap/cli.py,sha256=weYPXnpZ1200L28tNGzVaO_GlX7wAdLn1nQZsHKpe3k,29060
|
4
|
+
tgwrap/deploy.py,sha256=bJiox_fz8JsoPreX4woW6-EqAebhpJWnKUVLVeGXkrI,10000
|
5
|
+
tgwrap/main.py,sha256=82f4Wc-jPczDpP4vCMeJeaF1CBfiDGizNy0KDw_iDZw,74720
|
6
|
+
tgwrap/printer.py,sha256=dkcOCPIPB-IP6pn8QMpa06xlcqPFVaDvxnz-QEpDJV0,2663
|
7
|
+
tgwrap-0.8.12.dist-info/LICENSE,sha256=VT-AVxIXt3EQTC-7Hy1uPGnrDNJLqfcgLgJD78fiyx4,1065
|
8
|
+
tgwrap-0.8.12.dist-info/METADATA,sha256=RGlxakJg0v5wKWoma5H3rip2BTJ7mcmbq41iazo-VVE,11616
|
9
|
+
tgwrap-0.8.12.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
10
|
+
tgwrap-0.8.12.dist-info/entry_points.txt,sha256=H8X0PMPmd4aW7Y9iyChZ0Ug6RWGXqhRUvHH-6f6Mxz0,42
|
11
|
+
tgwrap-0.8.12.dist-info/RECORD,,
|
tgwrap-0.8.11.dist-info/RECORD
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
tgwrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
tgwrap/analyze.py,sha256=CsSaGv-be6ATy36z9X7x00gpKY59soJys2VbIzD-tmg,8726
|
3
|
-
tgwrap/cli.py,sha256=weYPXnpZ1200L28tNGzVaO_GlX7wAdLn1nQZsHKpe3k,29060
|
4
|
-
tgwrap/deploy.py,sha256=oD-H1ojdcSQTbiQHs7BZP9NnbV_MDtlpJFaDRl2-KvU,9578
|
5
|
-
tgwrap/main.py,sha256=Eocuece85XM5GHF6TA7OdhxHZqTlbSds5gu7lpZQGQA,74459
|
6
|
-
tgwrap/printer.py,sha256=dkcOCPIPB-IP6pn8QMpa06xlcqPFVaDvxnz-QEpDJV0,2663
|
7
|
-
tgwrap-0.8.11.dist-info/LICENSE,sha256=VT-AVxIXt3EQTC-7Hy1uPGnrDNJLqfcgLgJD78fiyx4,1065
|
8
|
-
tgwrap-0.8.11.dist-info/METADATA,sha256=l8Pmnql-7cijxcy8Hysw3Ka54ZQ2vYumjwDTz6TW3eQ,11529
|
9
|
-
tgwrap-0.8.11.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
10
|
-
tgwrap-0.8.11.dist-info/entry_points.txt,sha256=H8X0PMPmd4aW7Y9iyChZ0Ug6RWGXqhRUvHH-6f6Mxz0,42
|
11
|
-
tgwrap-0.8.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|