@@ -103,6 +103,7 @@ def deploy(src, requirements=False, local_package=None):
103
103
else :
104
104
create_function (cfg , path_to_zip_file )
105
105
106
+
106
107
def deploy_s3 (src , requirements = False , local_package = None ):
107
108
"""Deploys a new function via AWS S3.
108
109
@@ -130,6 +131,7 @@ def deploy_s3(src, requirements=False, local_package=None):
130
131
else :
131
132
create_function (cfg , path_to_zip_file , use_s3 , s3_file )
132
133
134
+
133
135
def upload (src , requirements = False , local_package = None ):
134
136
"""Uploads a new function to AWS S3.
135
137
@@ -462,20 +464,20 @@ def create_function(cfg, path_to_zip_file, *use_s3, **s3_file):
462
464
)
463
465
print ('Creating lambda function with name: {}' .format (func_name ))
464
466
465
- if use_s3 == True :
467
+ if use_s3 :
466
468
kwargs = {
467
469
'FunctionName' : func_name ,
468
470
'Runtime' : cfg .get ('runtime' , 'python2.7' ),
469
471
'Role' : role ,
470
472
'Handler' : cfg .get ('handler' ),
471
473
'Code' : {
472
474
'S3Bucket' : '{}' .format (buck_name ),
473
- 'S3Key' : '{}' .format (s3_file )
475
+ 'S3Key' : '{}' .format (s3_file ),
474
476
},
475
477
'Description' : cfg .get ('description' ),
476
478
'Timeout' : cfg .get ('timeout' , 15 ),
477
479
'MemorySize' : cfg .get ('memory_size' , 512 ),
478
- 'Publish' : True
480
+ 'Publish' : True ,
479
481
}
480
482
else :
481
483
kwargs = {
@@ -487,7 +489,7 @@ def create_function(cfg, path_to_zip_file, *use_s3, **s3_file):
487
489
'Description' : cfg .get ('description' ),
488
490
'Timeout' : cfg .get ('timeout' , 15 ),
489
491
'MemorySize' : cfg .get ('memory_size' , 512 ),
490
- 'Publish' : True
492
+ 'Publish' : True ,
491
493
}
492
494
493
495
if 'environment_variables' in cfg :
@@ -528,18 +530,18 @@ def update_function(cfg, path_to_zip_file, *use_s3, **s3_file):
528
530
os .environ .get ('S3_BUCKET_NAME' ) or cfg .get ('bucket_name' )
529
531
)
530
532
531
- if use_s3 == True :
533
+ if use_s3 :
532
534
client .update_function_code (
533
535
FunctionName = cfg .get ('function_name' ),
534
536
S3Bucket = '{}' .format (buck_name ),
535
537
S3Key = '{}' .format (s3_file ),
536
- Publish = True
538
+ Publish = True ,
537
539
)
538
540
else :
539
541
client .update_function_code (
540
542
FunctionName = cfg .get ('function_name' ),
541
543
ZipFile = byte_stream ,
542
- Publish = True
544
+ Publish = True ,
543
545
)
544
546
545
547
kwargs = {
@@ -569,6 +571,7 @@ def update_function(cfg, path_to_zip_file, *use_s3, **s3_file):
569
571
570
572
client .update_function_configuration (** kwargs )
571
573
574
+
572
575
def upload_s3 (cfg , path_to_zip_file , * use_s3 ):
573
576
"""Upload a function to AWS S3."""
574
577
@@ -604,7 +607,7 @@ def upload_s3(cfg, path_to_zip_file, *use_s3):
604
607
605
608
client .put_object (** kwargs )
606
609
print ('Finished uploading {} to S3 bucket {}' .format (func_name , buck_name ))
607
- if use_s3 == True :
610
+ if use_s3 :
608
611
return filename
609
612
610
613
0 commit comments