Updating the S3 example and fixing a bug in the way directories are zipped for upload to Lambda.
Showing
3 changed files
with
4 additions
and
3 deletions
... | @@ -69,6 +69,7 @@ def main(config=None, debug=False, command=None): | ... | @@ -69,6 +69,7 @@ def main(config=None, debug=False, command=None): |
69 | if command == 'deploy': | 69 | if command == 'deploy': |
70 | click.echo('Deploying ...') | 70 | click.echo('Deploying ...') |
71 | kappa.deploy() | 71 | kappa.deploy() |
72 | + click.echo('...done') | ||
72 | elif command == 'test': | 73 | elif command == 'test': |
73 | click.echo('Sending test data ...') | 74 | click.echo('Sending test data ...') |
74 | kappa.test() | 75 | kappa.test() | ... | ... |
... | @@ -91,7 +91,7 @@ class Kappa(object): | ... | @@ -91,7 +91,7 @@ class Kappa(object): |
91 | def _zip_lambda_dir(self, zipfile_name, lambda_dir): | 91 | def _zip_lambda_dir(self, zipfile_name, lambda_dir): |
92 | LOG.debug('_zip_lambda_dir: lambda_dir=%s', lambda_dir) | 92 | LOG.debug('_zip_lambda_dir: lambda_dir=%s', lambda_dir) |
93 | LOG.debug('zipfile_name=%s', zipfile_name) | 93 | LOG.debug('zipfile_name=%s', zipfile_name) |
94 | - relroot = os.path.abspath(os.path.join(lambda_dir, os.pardir)) | 94 | + relroot = os.path.abspath(lambda_dir) |
95 | with zipfile.ZipFile(zipfile_name, 'w') as zf: | 95 | with zipfile.ZipFile(zipfile_name, 'w') as zf: |
96 | for root, dirs, files in os.walk(lambda_dir): | 96 | for root, dirs, files in os.walk(lambda_dir): |
97 | zf.write(root, os.path.relpath(root, relroot)) | 97 | zf.write(root, os.path.relpath(root, relroot)) | ... | ... |
... | @@ -10,13 +10,13 @@ lambda: | ... | @@ -10,13 +10,13 @@ lambda: |
10 | name: S3Sample | 10 | name: S3Sample |
11 | zipfile_name: S3Sample.zip | 11 | zipfile_name: S3Sample.zip |
12 | description: Testing S3 Lambda handler | 12 | description: Testing S3 Lambda handler |
13 | - path: examplefolder | 13 | + path: examplefolder/ |
14 | handler: CreateThumbnail.handler | 14 | handler: CreateThumbnail.handler |
15 | runtime: nodejs | 15 | runtime: nodejs |
16 | memory_size: 128 | 16 | memory_size: 128 |
17 | timeout: 3 | 17 | timeout: 3 |
18 | mode: event | 18 | mode: event |
19 | test_data: input.json | 19 | test_data: input.json |
20 | - event_source: arn:aws:s3:::garnaat_pub | 20 | + event_source: arn:aws:s3:::sourcebucket |
21 | s3_events: | 21 | s3_events: |
22 | - s3:ObjectCreated:* | 22 | - s3:ObjectCreated:* |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment