Skip to content

Commit 5d9a6af

Browse files
committed
forgot to add refs to upload func
1 parent 9ff2c3e commit 5d9a6af

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

aws_lambda/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
__email__ = '[email protected]'
55
__version__ = '1.0.1'
66

7-
from .aws_lambda import deploy, invoke, init, build, cleanup_old_versions
7+
from .aws_lambda import deploy, invoke, init, build, upload, cleanup_old_versions
88

99
# Set default logging handler to avoid "No handler found" warnings.
1010
import logging

aws_lambda/aws_lambda.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ def upload_s3(cfg, path_to_zip_file):
476476
)
477477
kwargs = {
478478
'Bucket': cfg.get('bucket_name'),
479-
'Key': cfg.get('s3_key', '{}'.format(func_name)),
480-
'Body': {'ZipFile': byte_stream}
479+
'Key': cfg.get('s3_key', '{}.zip'.format(func_name)),
480+
'Body': byte_stream
481481
}
482482

483483
client.put_object(**kwargs)

scripts/lambda

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ def invoke(event_file, verbose):
4646
def deploy(use_requirements, local_package):
4747
aws_lambda.deploy(CURRENT_DIR, use_requirements, local_package)
4848

49-
49+
@click.command(help="Upload your lambda to S3.")
50+
@click.option('--use-requirements', default=False, is_flag=True, help='Install all packages defined in requirements.txt')
51+
@click.option('--local-package', default=None, help='Install local package as well.', type=click.Path(), multiple=True)
52+
def upload(use_requirements, local_package):
53+
aws_lambda.upload(CURRENT_DIR, use_requirements, local_package)
5054

5155
@click.command(help="Delete old versions of your functions")
5256
@click.option("--keep-last", type=int, prompt="Please enter the number of recent versions to keep")
@@ -57,6 +61,7 @@ if __name__ == '__main__':
5761
cli.add_command(init)
5862
cli.add_command(invoke)
5963
cli.add_command(deploy)
64+
cli.add_command(upload)
6065
cli.add_command(build)
6166
cli.add_command(cleanup)
6267
cli()

0 commit comments

Comments
 (0)