diff --git a/aws_lambda/aws_lambda.py b/aws_lambda/aws_lambda.py index 44f37cc..af56cef 100755 --- a/aws_lambda/aws_lambda.py +++ b/aws_lambda/aws_lambda.py @@ -80,7 +80,7 @@ def cleanup_old_versions(src, keep_last_versions, config_file='config.yaml'): def deploy( src, use_requirements=False, local_package=None, - config_file='config.yaml', + config_file='config.yaml', no_update_config=False, ): """Deploys a new function to AWS Lambda. @@ -106,7 +106,7 @@ def deploy( ) if function_exists(cfg, cfg.get('function_name')): - update_function(cfg, path_to_zip_file) + update_function(cfg, path_to_zip_file,no_update_config) else: create_function(cfg, path_to_zip_file) @@ -531,7 +531,7 @@ def create_function(cfg, path_to_zip_file, *use_s3, **s3_file): client.create_function(**kwargs) -def update_function(cfg, path_to_zip_file, *use_s3, **s3_file): +def update_function(cfg, path_to_zip_file,no_update_config=False, *use_s3, **s3_file): """Updates the code of an existing Lambda function""" print('Updating your Lambda function') @@ -595,8 +595,11 @@ def update_function(cfg, path_to_zip_file, *use_s3, **s3_file): }, }, ) - - client.update_function_configuration(**kwargs) + if not no_update_config: + print('Updating configuration') + client.update_function_configuration(**kwargs) + else: + print('NOT updating configuration') def upload_s3(cfg, path_to_zip_file, *use_s3): diff --git a/scripts/lambda b/scripts/lambda index 3f3f7ae..0c7ce31 100755 --- a/scripts/lambda +++ b/scripts/lambda @@ -98,6 +98,12 @@ def invoke(event_file, config_file, verbose): is_flag=True, help='Install all packages defined in requirements.txt', ) +@click.option( + '--no-update-config', + default=False, + is_flag=True, + help='Do not update lambda configuration', +) @click.option( '--local-package', default=None, @@ -105,12 +111,13 @@ def invoke(event_file, config_file, verbose): help='Install local package as well.', multiple=True, ) -def deploy(use_requirements, local_package, config_file): +def deploy(use_requirements, local_package, config_file,no_update_config): aws_lambda.deploy( CURRENT_DIR, config_file=config_file, use_requirements=use_requirements, local_package=local_package, + no_update_config=no_update_config )