10000 fix lambda mounting · localstack/localstack@2b4e0bb · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b4e0bb

Browse files
committed
fix lambda mounting
1 parent 53412eb commit 2b4e0bb

File tree

6 files changed

+14
-6
lines changed

6 files changed

+14
-6
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: ## 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/firehose/firehose_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def create_stream(stream_name, delivery_stream_type='DirectPut', delivery_stream
157157
if s3_destination:
158158
update_destination(stream_name=stream_name, destination_id=short_uid(), s3_update=s3_destination)
159159

160+
print('create Firehose stream', stream_name, delivery_stream_type)
160161
if delivery_stream_type == 'KinesisStreamAsSource':
161162
kinesis_stream_name = delivery_stream_type_configuration.get('KinesisStreamARN').split('/')[1]
162163
kinesis_connector.listen_to_kinesis(

localstack/utils/kinesis/kclipy_helper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def get_kcl_dir():
1919

2020
def get_kcl_jar_path():
2121
jars = ':'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar')))
22+
print('JARs in KCL dir %s' % (get_kcl_dir(), jars))
23+
import sys
24+
sys.stdout.flush()
2225
return jars
2326

2427

localstack/utils/kinesis/kinesis_connector.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def __init__(self, params):
116116
env_vars = params['env_vars']
117117
cmd = kclipy_helper.get_kcl_app_command('java',
118118
MULTI_LANG_DAEMON_CLASS, props_file)
119+
print('kinesis processor cmd', cmd)
119120
if not params['log_file']:
120121
params['log_file'] = '%s.log' % props_file
121122
TMP_FILES.append(params['log_file'])
@@ -412,6 +413,7 @@ def listen_to_kinesis(stream_name, listener_func=None, processor_script=None,
412413
and receive events in a listener function. A KCL client process is
413414
automatically started in the background.
414415
"""
416+
print('listen_to_kinesis', stream_name)
415417
env = aws_stack.get_environment(env)
416418
if not events_file:
417419
events_file = EVENTS_FILE_PATTERN.replace('*', short_uid())

0 commit comments

Comments
 (0)
0