Skip to content

Commit eb54586

Browse files
committed
Remove hash_extra_paths, similar functionality is implemented with hash_internal
1 parent 32efef0 commit eb54586

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

package.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -685,17 +685,15 @@ def __init__(self, args, log=None):
685685
self._source_paths = None
686686
self._log = log or logging.root
687687

688-
def hash(self, extra_paths):
688+
def hash(self):
689689
if not self._source_paths:
690690
raise ValueError("BuildPlanManager.plan() should be called first")
691691

692-
content_hash_paths = self._source_paths + [(p, None, None) for p in extra_paths]
693-
694692
# Generate a hash based on file names and content. Also use the
695693
# runtime value, build command, and content of the build paths
696694
# because they can have an effect on the resulting archive.
697695
self._log.debug("Computing content hash on files...")
698-
content_hash = generate_content_hash(content_hash_paths, log=self._log)
696+
content_hash = generate_content_hash(self._source_paths, log=self._log)
699697
return content_hash
700698

701699
def plan(self, source_path, query, log=None):
@@ -1986,7 +1984,7 @@ def prepare_command(args):
19861984
if log.isEnabledFor(DEBUG3):
19871985
log.debug("QUERY: %s", json.dumps(query_data, indent=2))
19881986
else:
1989-
log_excludes = ("source_path", "hash_extra_paths", "hash_internal", "paths")
1987+
log_excludes = ("source_path", "hash_internal", "paths")
19901988
qd = {k: v for k, v in query_data.items() if k not in log_excludes}
19911989
log.debug("QUERY (excerpt): %s", json.dumps(qd, indent=2))
19921990

@@ -1996,7 +1994,6 @@ def prepare_command(args):
19961994
runtime = query.runtime
19971995
function_name = query.function_name
19981996
artifacts_dir = query.artifacts_dir
1999-
hash_extra_paths = query.hash_extra_paths
20001997
source_path = query.source_path
20011998
hash_extra = query.hash_extra
20021999
hash_internal = query.hash_internal
@@ -2013,10 +2010,7 @@ def prepare_command(args):
20132010
if log.isEnabledFor(DEBUG2):
20142011
log.debug("BUILD_PLAN: %s", json.dumps(build_plan, indent=2))
20152012

2016-
# Expand a Terraform path.<cwd|root|module> references
2017-
hash_extra_paths = [p.format(path=tf_paths) for p in hash_extra_paths]
2018-
2019-
content_hash = bpm.hash(hash_extra_paths)
2013+
content_hash = bpm.hash()
20202014
content_hash.update(json.dumps(build_plan, sort_keys=True).encode())
20212015
content_hash.update(runtime.encode())
20222016
for c in hash_internal:

package.tf

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ data "external" "archive_prepare" {
2626
docker_entrypoint = var.docker_entrypoint
2727
}) : null
2828

29-
artifacts_dir = var.artifacts_dir
30-
runtime = var.runtime
31-
source_path = try(tostring(var.source_path), jsonencode(var.source_path))
32-
hash_extra = var.hash_extra
33-
hash_extra_paths = jsonencode([])
29+
artifacts_dir = var.artifacts_dir
30+
runtime = var.runtime
31+
source_path = try(tostring(var.source_path), jsonencode(var.source_path))
32+
hash_extra = var.hash_extra
3433
# Include into the hash the module sources that affect the packaging.
3534
hash_internal = jsonencode([filesha256("${path.module}/package.py")])
3635

0 commit comments

Comments
 (0)