@@ -107,7 +107,8 @@ def parse_args(init_vars=None, tf_vars=None, targets=None, **kw):
107107 ]
108108 for arg in _TG_KV_ARGS :
109109 if kw .get (f"tg_{ arg } " ):
110- cmd_args += [f'--terragrunt-{ arg .replace ("_" , "-" )} ' , kw [f"tg_{ arg } " ]]
110+ cmd_args += [f'--terragrunt-{ arg .replace ("_" , "-" )} ' ,
111+ kw [f"tg_{ arg } " ]]
111112 if kw .get ('tg_parallelism' ):
112113 cmd_args .append (f'--terragrunt-parallelism { kw ["tg_parallelism" ]} ' )
113114 if isinstance (kw .get ('tg_override_attr' ), dict ):
@@ -241,10 +242,8 @@ def __init__(self, raw):
241242 (v ['address' ], v ) for v in self ._raw .get ('resource_changes' , {}))
242243 # there might be no variables defined
243244 self .variables = TerraformValueDict (raw .get ('variables' , {}))
244-
245- prior_state = raw .get ('prior_state' , {})
246- values = prior_state .get ('values' , {})
247- self .prior_root_module = TerraformPlanModule (values .get ('root_module' , {}))
245+ self .prior_root_module = TerraformPlanModule (
246+ raw .get ('prior_state' , {}).get ('values' , {}).get ('root_module' , {}))
248247
249248 @property
250249 def resources (self ):
@@ -337,7 +336,8 @@ def __init__(self, tfdir, basedir=None, binary='terraform', env=None,
337336 self .env = os .environ .copy ()
338337 self .tg_run_all = False
339338 self ._plan_formatter = lambda out : TerraformPlanOutput (json .loads (out ))
340- self ._output_formatter = lambda out : TerraformValueDict (json .loads (out ))
339+ self ._output_formatter = lambda out : TerraformValueDict (
340+ json .loads (out ))
341341 self .enable_cache = enable_cache
342342 if not cache_dir :
343343 self .cache_dir = Path (os .path .dirname (
@@ -372,11 +372,13 @@ def remove_readonly(func, path, excinfo):
372372 for tg_dir in glob .glob (path , recursive = True ):
373373 if os .path .isdir (tg_dir ):
374374 shutil .rmtree (tg_dir , onerror = remove_readonly )
375- _LOGGER .debug ('Restoring original TF files after prevent destroy changes' )
375+ _LOGGER .debug (
376+ 'Restoring original TF files after prevent destroy changes' )
376377 if restore_files :
377378 for bkp_file in Path (tfdir ).rglob ('*.bkp' ):
378379 try :
379- shutil .copy (str (bkp_file ), f'{ str (bkp_file ).strip (".bkp" )} ' )
380+ shutil .copy (str (bkp_file ),
381+ f'{ str (bkp_file ).strip (".bkp" )} ' )
380382 except (IOError , OSError ):
381383 _LOGGER .exception (
382384 f'Unable to restore terraform file { bkp_file .resolve ()} ' )
@@ -467,7 +469,8 @@ def cache(self, **kwargs):
467469 return func (self , ** kwargs )
468470
469471 cache_dir = self .cache_dir / \
470- Path (sha1 (self .tfdir .encode ("cp037" )).hexdigest ()) / Path (func .__name__ )
472+ Path (sha1 (self .tfdir .encode ("cp037" )).hexdigest ()) / \
473+ Path (func .__name__ )
471474 cache_dir .mkdir (parents = True , exist_ok = True )
472475
473476 hash_filename = self .generate_cache_hash (kwargs )
@@ -642,7 +645,8 @@ def plan(self, input=False, color=False, refresh=True, tf_vars=None,
642645 try :
643646 return self ._plan_formatter (result .out )
644647 except json .JSONDecodeError as e :
645- raise TerraformTestError ('Error decoding plan output: {}' .format (e ))
648+ raise TerraformTestError (
649+ 'Error decoding plan output: {}' .format (e ))
646650
647651 @_cache
648652 def apply (self , input = False , color = False , auto_approve = True , tf_vars = None ,
@@ -715,8 +719,8 @@ def execute_command(self, cmd, *cmd_args):
715719 full_output_lines = []
716720 try :
717721 stderr_mode = subprocess .STDOUT if os .name == 'nt' else subprocess .PIPE
718- p = subprocess .Popen (cmdline , stdout = subprocess .PIPE ,
719- stderr = stderr_mode , cwd = self .tfdir , env = self .env ,
722+ p = subprocess .Popen (cmdline , stdout = subprocess .PIPE , stderr = stderr_mode ,
723+ cwd = self .tfdir , env = self .env ,
720724 universal_newlines = True , encoding = 'utf-8' ,
721725 errors = 'ignore' )
722726 while True :
0 commit comments