8000 fix lambda mounting · localstack/localstack@4e7eb8e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4e7eb8e

Browse files
committed
fix lambda mounting
1 parent 53412eb commit 4e7eb8e

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ init: ## Initialize the infrastructure, make sure all libs are down
4444
$(VENV_RUN); PYTHONPATH=. exec python localstack/services/install.py libs
4545

4646
infra< 10000 /span>: ## Manually start the local infrastructure for testing
47-
($(VENV_RUN); exec bin/localstack start)
47+
($(VENV_RUN); exec bin/localstack start --host)
4848

4949
docker-build: ## Build Docker image
5050
docker build -t $(IMAGE_NAME) .

bin/localstack

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import glob
2323
import json
2424
import traceback
2525

26-
PARENT_FOLDER = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
26+
PARENT_FOLDER = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
2727
venv_dir = os.path.join(PARENT_FOLDER, '.venv')
2828
if os.path.isdir(venv_dir):
2929
for path in glob.glob(os.path.join(venv_dir, 'lib/python*/site-packages')):

localstack/services/awslambda/lambda_api.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,6 @@ def execute(event, context):
465465

466466

467467
def set_archive_code(code, lambda_name, zip_file_content=None):
468-
# get file content
469-
zip_file_content = zip_file_content or get_zip_bytes(code)
470468

471469
# get metadata
472470
lambda_arn = func_arn(lambda_name)
@@ -483,6 +481,9 @@ def set_archive_code(code, lambda_name, zip_file_content=None):
483481
# this folder to TMP_FILES or similar).
484482
return code['S3Key']
485483

484+
# get file content
485+
zip_file_content = zip_file_content or get_zip_bytes(code)
486+
486487
# Save the zip file to a temporary file that the lambda executors can reference
487488
code_sha_256 = base64.standard_b64encode(hashlib.sha256(zip_file_content).digest())
488489
lambda_details.get_version('$LATEST')['CodeSize'] = len(zip_file_content)
@@ -514,8 +515,9 @@ def generic_handler(event, context):
514515

515516
if code_passed:
516517
lambda_cwd = lambda_cwd or set_archive_code(code_passed, lambda_name)
517-
# Save the zip file to a temporary file that the lambda executors can reference
518-
zip_file_content = get_zip_bytes(code_passed)
518+
if not is_local_mount:
519+
# Save the zip file to a temporary file that the lambda executors can reference
520+
zip_file_content = get_zip_bytes(code_passed)
519521
else:
520522
lambda_cwd = lambda_cwd or lambda_details.cwd
521523

localstack/services/install.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
URL_LOCALSTACK_FAT_JAR = ('https://repo1.maven.org/maven2/' +
3232
'cloud/localstack/localstack-utils/{v}/localstack-utils-{v}-fat.jar').format(v=LOCALSTACK_MAVEN_VERSION)
3333

34+
# Target version for javac, to ensure compatibility with earlier JREs
35+
JAVAC_TARGET_VERSION = '1.8'
36+
3437
# set up logger
3538
LOGGER = logging.getLogger(__name__)
3639

@@ -151,7 +154,7 @@ def install_amazon_kinesis_client_libs():
151154
java_files = '%s/utils/kinesis/java/cloud/localstack/*.java' % ROOT_PATH
152155
class_files = '%s/utils/kinesis/java/cloud/localstack/*.class' % ROOT_PATH
153156
if not glob.glob(class_files):
154-
run('javac -cp "%s" %s' % (classpath, java_files))
157+
run('javac -target %s -cp "%s" %s' % (JAVAC_TARGET_VERSION, classpath, java_files))
155158

156159

157160
def install_lambda_java_libs():
@@ -225,7 +228,7 @@ def download_and_extract():
225228
logging.basicConfig(level=logging.INFO)
226229
logging.getLogger('requests').setLevel(logging.WARNING)
227230
install_all_components()
228-
print('Done.')
229-
elif sys.argv[1] == 'testlibs':
231+
if sys.argv[1] in ('libs', 'testlibs'):
230232
# Install additional libraries for testing
231233
install_amazon_kinesis_client_libs()
234+
print('Done.')

0 commit comments

Comments
 (0)
0