@@ -216,7 +216,8 @@ def generate_content_hash(source_paths,
216
216
for source_path in source_paths :
217
217
if os .path .isdir (source_path ):
218
218
source_dir = source_path
219
- for source_file in list_files (source_dir , logger = logger ):
219
+ _logger = logger if logger .isEnabledFor (DEBUG3 ) else None
220
+ for source_file in list_files (source_dir , logger = _logger ):
220
221
update_hash (hash_obj , source_dir , source_file )
221
222
if logger :
222
223
logger .debug (os .path .join (source_dir , source_file ))
@@ -488,8 +489,9 @@ def str_int_to_timestamp(s):
488
489
class BuildPlanManager :
489
490
""""""
490
491
491
- def __init__ (self ):
492
+ def __init__ (self , logger = None ):
492
493
self ._source_paths = None
494
+ self ._logger = logger or logging .root
493
495
494
496
def hash (self , extra_paths ):
495
497
if not self ._source_paths :
@@ -500,8 +502,9 @@ def hash(self, extra_paths):
500
502
# Generate a hash based on file names and content. Also use the
501
503
# runtime value, build command, and content of the build paths
502
504
# because they can have an effect on the resulting archive.
503
- logger .debug ("Computing content hash on files..." )
504
- content_hash = generate_content_hash (content_hash_paths , logger = logger )
505
+ self ._logger .debug ("Computing content hash on files..." )
506
+ content_hash = generate_content_hash (content_hash_paths ,
507
+ logger = self ._logger )
505
508
return content_hash
506
509
507
510
def plan (self , source_path , query ):
@@ -708,7 +711,7 @@ def prepare_command(args):
708
711
recreate_missing_package = yesno_bool (args .recreate_missing_package )
709
712
docker = query .docker
710
713
711
- bpm = BuildPlanManager ()
714
+ bpm = BuildPlanManager (logger = logger )
712
715
build_plan = bpm .plan (source_path , query )
713
716
714
717
# Expand a Terraform path.<cwd|root|module> references
@@ -799,7 +802,7 @@ def build_command(args):
799
802
# Zip up the build plan and write it to the target filename.
800
803
# This will be used by the Lambda function as the source code package.
801
804
with ZipWriteStream (filename ) as zs :
802
- bpm = BuildPlanManager ()
805
+ bpm = BuildPlanManager (logger = logger )
803
806
bpm .execute (build_plan , zs , query )
804
807
805
808
os .utime (filename , ns = (timestamp , timestamp ))
0 commit comments