Skip to content

Commit 7a174b8

Browse files
committed
fix: loop through all possible executable paths.
1 parent 79007a4 commit 7a174b8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

aws_lambda_builders/workflow.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from aws_lambda_builders.path_resolver import PathResolver
1313
from aws_lambda_builders.validator import RuntimeValidator
1414
from aws_lambda_builders.registry import DEFAULT_REGISTRY
15-
from aws_lambda_builders.exceptions import WorkflowFailedError, WorkflowUnknownError
15+
from aws_lambda_builders.exceptions import WorkflowFailedError, WorkflowUnknownError, MisMatchRuntimeError
1616
from aws_lambda_builders.actions import ActionFailedError
1717

1818
LOG = logging.getLogger(__name__)
@@ -35,15 +35,18 @@ def sanitize(func):
3535
@functools.wraps(func)
3636
def wrapper(self, *args, **kwargs):
3737
valid_paths = []
38-
# NOTE: we need to access workflow object to get the validator.
38+
# NOTE: we need to access binaries to get paths and resolvers, before validating.
3939
self.get_binaries()
40-
# import ipdb
41-
# ipdb.set_trace()
4240
for binary_path in self.binaries:
4341
validator = binary_path.validator
4442
exec_paths = binary_path.resolver.exec_paths if not binary_path.path_provided else binary_path.binary_path
4543
for executable_path in exec_paths:
46-
valid_path = validator.validate(executable_path)
44+
valid_path = None
45+
try:
46+
valid_path = validator.validate(executable_path)
47+
except MisMatchRuntimeError as ex:
48+
LOG.debug("Invalid executable for %s at %s",
49+
binary_path.binary, executable_path, exc_info=str(ex))
4750
if valid_path:
4851
binary_path.binary_path = valid_path
4952
valid_paths.append(valid_path)

tests/integration/workflows/python_pip/test_python_pip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_mismatch_runtime_python_project(self):
6060
try:
6161
self.builder.build(self.source_dir, self.artifacts_dir, self.scratch_dir, self.manifest_path_valid,
6262
runtime=self.runtime_mismatch[self.runtime])
63-
except MisMatchRuntimeError:
63+
except WorkflowFailedError:
6464
self.assertIsNone(which(self.runtime_mismatch[self.runtime]))
6565

6666
def test_runtime_validate_python_project_fail_open_unsupported_runtime(self):

0 commit comments

Comments
 (0)