tgwrap 0.8.7__py3-none-any.whl → 0.8.9__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 +1 -1
- tgwrap/main.py +46 -34
- {tgwrap-0.8.7.dist-info → tgwrap-0.8.9.dist-info}/METADATA +2 -1
- tgwrap-0.8.9.dist-info/RECORD +11 -0
- {tgwrap-0.8.7.dist-info → tgwrap-0.8.9.dist-info}/WHEEL +1 -1
- tgwrap-0.8.7.dist-info/RECORD +0 -11
- {tgwrap-0.8.7.dist-info → tgwrap-0.8.9.dist-info}/LICENSE +0 -0
- {tgwrap-0.8.7.dist-info → tgwrap-0.8.9.dist-info}/entry_points.txt +0 -0
tgwrap/deploy.py
CHANGED
@@ -60,7 +60,7 @@ def run_sync(
|
|
60
60
|
f"--include='{terragrunt_file}' {lock_file_stmt} {env_file_stmt} {excludes_stmt} " + \
|
61
61
|
"--exclude='.terragrunt-cache/' --exclude='.terraform/' " + \
|
62
62
|
"--exclude='terragrunt-debug.tfvars.json' --exclude=planfile " + \
|
63
|
-
"--exclude='.DS_Store' "
|
63
|
+
"--exclude='.DS_Store' --exclude='*.log'"
|
64
64
|
|
65
65
|
cmd = f"rsync -aim {dry_run_stmt} {clean_stmt} " + \
|
66
66
|
include_statements + \
|
tgwrap/main.py
CHANGED
@@ -102,7 +102,7 @@ class TgWrap():
|
|
102
102
|
'info': '{base_command} terragrunt-info --terragrunt-non-interactive {update} {upgrade} {common}',
|
103
103
|
'plan': '{base_command} {command} --terragrunt-non-interactive -out={planfile_name} {lock_level} {update} {parallelism} {common}',
|
104
104
|
'apply': '{base_command} {command} {non_interactive} {no_auto_approve} {update} {parallelism} {common} {planfile}',
|
105
|
-
'show': '{base_command} {command} --terragrunt-non-interactive {
|
105
|
+
'show': '{base_command} {command} --terragrunt-non-interactive {planfile_name} {common}',
|
106
106
|
'destroy': '{base_command} {command} {non_interactive} {no_auto_approve} {parallelism} {common} {planfile}',
|
107
107
|
}
|
108
108
|
|
@@ -391,48 +391,53 @@ class TgWrap():
|
|
391
391
|
# remove empty strings
|
392
392
|
tags = [tag for tag in tags if tag != ""]
|
393
393
|
|
394
|
-
|
395
|
-
raise Exception('Could not load tags in source repository, cannot deploy without it.')
|
394
|
+
tags.insert(0, self.LATEST_VERSION)
|
396
395
|
|
397
396
|
return tags
|
398
397
|
|
399
398
|
def check_version_tag(reference, working_dir):
|
399
|
+
is_latest = (reference == self.LATEST_VERSION)
|
400
400
|
is_branch = False
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
is_tag = tag_process.returncode == 0
|
411
|
-
self.printer.verbose(f'Check for tag: {tag_process}')
|
412
|
-
|
413
|
-
# if it is not a tag, then it might be a branch
|
414
|
-
if not is_tag:
|
415
|
-
branch_command = f'git switch {reference}'
|
416
|
-
branch_process = subprocess.run(
|
417
|
-
shlex.split(branch_command),
|
401
|
+
is_tag = False
|
402
|
+
|
403
|
+
if not is_latest:
|
404
|
+
quiet_mode = "" if self.printer.print_verbose else "--quiet"
|
405
|
+
|
406
|
+
# Check if the given reference is a tag
|
407
|
+
tag_command = f'git show-ref --verify {quiet_mode} refs/tags/{reference}'
|
408
|
+
tag_process = subprocess.run(
|
409
|
+
shlex.split(tag_command),
|
418
410
|
cwd=working_dir,
|
419
411
|
capture_output=True,
|
420
412
|
)
|
421
|
-
|
422
|
-
self.printer.verbose(f'Check for
|
413
|
+
is_tag = tag_process.returncode == 0
|
414
|
+
self.printer.verbose(f'Check for tag: {tag_process}')
|
415
|
+
|
416
|
+
# if it is not a tag, then it might be a branch
|
417
|
+
if not is_tag:
|
418
|
+
branch_command = f'git switch {reference}'
|
419
|
+
branch_process = subprocess.run(
|
420
|
+
shlex.split(branch_command),
|
421
|
+
cwd=working_dir,
|
422
|
+
capture_output=True,
|
423
|
+
)
|
424
|
+
is_branch = branch_process.returncode == 0
|
425
|
+
self.printer.verbose(f'Check for branch: {branch_process}')
|
423
426
|
|
424
427
|
# Print the result
|
425
|
-
if
|
428
|
+
if is_latest:
|
429
|
+
self.printer.verbose(f"The given reference '{reference}' is the latest version.")
|
430
|
+
elif is_branch:
|
426
431
|
self.printer.verbose(f"The given reference '{reference}' is a branch.")
|
427
432
|
elif is_tag:
|
428
433
|
self.printer.verbose(f"The given reference '{reference}' is a tag.")
|
429
434
|
else:
|
430
|
-
msg = f"The given reference '{reference}' is neither a branch nor a tag."
|
431
|
-
self.printer.verbose(
|
435
|
+
msg = f"The given reference '{reference}' is neither latest, a branch nor a tag."
|
436
|
+
self.printer.verbose(msg)
|
432
437
|
raise Exception(msg)
|
433
438
|
|
434
439
|
|
435
|
-
return is_branch, is_tag
|
440
|
+
return is_latest, is_branch, is_tag
|
436
441
|
|
437
442
|
# clone the repo
|
438
443
|
repo = manifest['git_repository']
|
@@ -461,14 +466,16 @@ class TgWrap():
|
|
461
466
|
self.printer.normal
|
462
467
|
|
463
468
|
# first check if we have a tag or a branch
|
464
|
-
is_branch, is_tag = check_version_tag(
|
469
|
+
is_latest, is_branch, is_tag = check_version_tag(
|
465
470
|
reference=version_tag,
|
466
471
|
working_dir=target_dir,
|
467
472
|
)
|
468
473
|
|
469
474
|
self.printer.header(f'Deploy using reference {version_tag}')
|
470
475
|
|
471
|
-
if
|
476
|
+
if is_latest:
|
477
|
+
pass # nothing to do, we already have latest
|
478
|
+
elif is_tag:
|
472
479
|
cmd = f"git checkout -b source {version_tag}"
|
473
480
|
rc = subprocess.run(
|
474
481
|
shlex.split(cmd),
|
@@ -530,8 +537,6 @@ class TgWrap():
|
|
530
537
|
|
531
538
|
self.printer.verbose(f'Execute command: {command} in working dir: {working_dir}')
|
532
539
|
|
533
|
-
self.printer.verbose(f'Executing in directory: {working_dir}')
|
534
|
-
|
535
540
|
self.printer.header(
|
536
541
|
f'\n\nStart processing module: {module} ({progress})\n\n',
|
537
542
|
print_line_before=True,
|
@@ -844,15 +849,20 @@ class TgWrap():
|
|
844
849
|
if not planfile_dir:
|
845
850
|
self.printer.verbose('Use terragrunt for showing plan')
|
846
851
|
|
847
|
-
|
848
|
-
|
852
|
+
# some environments raise the error: AttributeError: ‘tuple’ object has no attribute ‘append’
|
853
|
+
# so convert to a list to make it updateable
|
854
|
+
tg_args_list = list(terragrunt_args)
|
855
|
+
|
856
|
+
# first run a 'show' and write output to file
|
857
|
+
if '-json' not in tg_args_list:
|
858
|
+
tg_args_list.append('-json')
|
849
859
|
|
850
860
|
cmd = self._construct_command(
|
851
861
|
command='show',
|
852
862
|
allow_no_run_all=True,
|
853
863
|
exclude_external_dependencies=True,
|
854
864
|
debug=False,
|
855
|
-
terragrunt_args=
|
865
|
+
terragrunt_args=tg_args_list,
|
856
866
|
)
|
857
867
|
else:
|
858
868
|
cwd = os.path.join(cwd, planfile_dir)
|
@@ -999,7 +1009,9 @@ class TgWrap():
|
|
999
1009
|
|
1000
1010
|
use_native_terraform = False
|
1001
1011
|
|
1002
|
-
|
1012
|
+
# some environments raise the error: AttributeError: ‘tuple’ object has no attribute ‘append’
|
1013
|
+
# so convert to a list to make it updateable
|
1014
|
+
tg_args_list = list(terragrunt_args)
|
1003
1015
|
|
1004
1016
|
# first run a 'show' and write output to file
|
1005
1017
|
if '-json' not in tg_args_list:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tgwrap
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.9
|
4
4
|
Summary: A (terragrunt) wrapper around a (terraform) wrapper around ....
|
5
5
|
Home-page: https://gitlab.com/lunadata/tgwrap
|
6
6
|
License: MIT
|
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.9
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
17
18
|
Requires-Dist: click (>=8.0)
|
18
19
|
Requires-Dist: inquirer (>=3.1.4,<4.0.0)
|
19
20
|
Requires-Dist: networkx (>=2.8.8,<3.0.0)
|
@@ -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=RvOQ0ILg3QfeJx70G6nFj7vGF4nT5cJgttXKwiwYHu4,9577
|
5
|
+
tgwrap/main.py,sha256=ltOAJaACSneLECgcCYzqwQuoJZZe88juoQOfwsFZzJA,74105
|
6
|
+
tgwrap/printer.py,sha256=dkcOCPIPB-IP6pn8QMpa06xlcqPFVaDvxnz-QEpDJV0,2663
|
7
|
+
tgwrap-0.8.9.dist-info/LICENSE,sha256=VT-AVxIXt3EQTC-7Hy1uPGnrDNJLqfcgLgJD78fiyx4,1065
|
8
|
+
tgwrap-0.8.9.dist-info/METADATA,sha256=LWUMZU9fMpqNRKlaWb17NCPxxc_frBgxjRUP66jdkgs,11528
|
9
|
+
tgwrap-0.8.9.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
10
|
+
tgwrap-0.8.9.dist-info/entry_points.txt,sha256=H8X0PMPmd4aW7Y9iyChZ0Ug6RWGXqhRUvHH-6f6Mxz0,42
|
11
|
+
tgwrap-0.8.9.dist-info/RECORD,,
|
tgwrap-0.8.7.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=GBEtPTrKxvvSXJPi-peKmP6fjgY4z0PQ4gPSd9btleo,9560
|
5
|
-
tgwrap/main.py,sha256=c6FB7guu34zUCDqAGnNGTnhAWbbvJtlbbxADDWYlMj0,73524
|
6
|
-
tgwrap/printer.py,sha256=dkcOCPIPB-IP6pn8QMpa06xlcqPFVaDvxnz-QEpDJV0,2663
|
7
|
-
tgwrap-0.8.7.dist-info/LICENSE,sha256=VT-AVxIXt3EQTC-7Hy1uPGnrDNJLqfcgLgJD78fiyx4,1065
|
8
|
-
tgwrap-0.8.7.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
|
9
|
-
tgwrap-0.8.7.dist-info/entry_points.txt,sha256=H8X0PMPmd4aW7Y9iyChZ0Ug6RWGXqhRUvHH-6f6Mxz0,42
|
10
|
-
tgwrap-0.8.7.dist-info/METADATA,sha256=ELVBohC5T6kLLOkdWY7PIKXfEkQSxmwY2dxE9RpZMyg,11477
|
11
|
-
tgwrap-0.8.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|