From 8b7393db94d26f8e792673b869efe552b412dbf0 Mon Sep 17 00:00:00 2001 From: Kivol Date: Tue, 5 Feb 2019 02:31:54 +0900 Subject: [PATCH 1/2] Added layer option for deploy function update-config --- lib/plugins/aws/deployFunction/index.js | 5 +++++ lib/plugins/aws/deployFunction/index.test.js | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lib/plugins/aws/deployFunction/index.js b/lib/plugins/aws/deployFunction/index.js index db92c4939..33729cb83 100644 --- a/lib/plugins/aws/deployFunction/index.js +++ b/lib/plugins/aws/deployFunction/index.js @@ -102,6 +102,7 @@ class AwsDeployFunction { } callUpdateFunctionConfiguration(params) { + console.info(params); return this.provider.request( 'Lambda', 'updateFunctionConfiguration', @@ -145,6 +146,10 @@ class AwsDeployFunction { params.Timeout = providerObj.timeout; } + if ('layers' in functionObj && _.isArray(functionObj.layers) && !_.some(functionObj.layers, _.isObject)) { + params.Layers = functionObj.layers; + } + if (functionObj.onError && !_.isObject(functionObj.onError)) { params.DeadLetterConfig = { TargetArn: functionObj.onError, diff --git a/lib/plugins/aws/deployFunction/index.test.js b/lib/plugins/aws/deployFunction/index.test.js index e68fcfe7c..0321e2422 100644 --- a/lib/plugins/aws/deployFunction/index.test.js +++ b/lib/plugins/aws/deployFunction/index.test.js @@ -231,6 +231,7 @@ describe('AwsDeployFunction', () => { securityGroupIds: ['1'], subnetIds: ['2'], }, + layers: ['arn:aws:lambda:us-east-1:123456789012:layer:layer:1'], }; awsDeployFunction.options = options; @@ -262,6 +263,7 @@ describe('AwsDeployFunction', () => { SecurityGroupIds: ['1'], SubnetIds: ['2'], }, + Layers: ['arn:aws:lambda:us-east-1:123456789012:layer:layer:1'], } )).to.be.equal(true); }); From c09355b4e0f47ded53bafe49bd6ed6c296c653ba Mon Sep 17 00:00:00 2001 From: Kivol Date: Tue, 5 Feb 2019 09:59:39 +0900 Subject: [PATCH 2/2] Passing lint --- lib/plugins/aws/deployFunction/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/plugins/aws/deployFunction/index.js b/lib/plugins/aws/deployFunction/index.js index 33729cb83..cab694f3b 100644 --- a/lib/plugins/aws/deployFunction/index.js +++ b/lib/plugins/aws/deployFunction/index.js @@ -102,7 +102,6 @@ class AwsDeployFunction { } callUpdateFunctionConfiguration(params) { - console.info(params); return this.provider.request( 'Lambda', 'updateFunctionConfiguration', @@ -146,7 +145,11 @@ class AwsDeployFunction { params.Timeout = providerObj.timeout; } - if ('layers' in functionObj && _.isArray(functionObj.layers) && !_.some(functionObj.layers, _.isObject)) { + if ( + 'layers' in functionObj + && _.isArray(functionObj.layers) + && !_.some(functionObj.layers, _.isObject) + ) { params.Layers = functionObj.layers; }