Skip to content

Commit

Permalink
Check if S3 bucket exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Dgadavin committed Apr 10, 2019
1 parent 020d1fb commit 0843e95
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 12 additions & 0 deletions function/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@ func (f *Function) Update(zip []byte, session *session.Session) error {
//Upload to s3, and set update configuration
var s3bucket string
var s3key string

if len(f.S3Bucket) < 1 {
f.Log.Errorf("Please provide S3Bucket name in function config file")
os.Exit(1)
}

if strings.Contains(f.S3Bucket, "/") {
tmp := strings.Split(f.S3Bucket, "/")
s3bucket = tmp[0]
Expand Down Expand Up @@ -463,6 +469,12 @@ func (f *Function) Create(zip []byte, session *session.Session) error {
//Safe zip to file, Upload to s3, and set update configuration
var s3bucket string
var s3key string

if len(f.S3Bucket) < 1 {
f.Log.Errorf("Please provide S3Bucket name in function config file")
os.Exit(1)
}

if strings.Contains(f.S3Bucket, "/") {
tmp := strings.Split(f.S3Bucket, "/")
s3bucket = tmp[0]
Expand Down
1 change: 0 additions & 1 deletion project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/pkg/errors"
"github.com/tj/go-sync/semaphore"
"gopkg.in/validator.v2"

"apex/function"
"apex/hooks"
Expand Down

0 comments on commit 0843e95

Please sign in to comment.