From b15d0963f4f4a6fb04321a751f4dc67a80d4187f Mon Sep 17 00:00:00 2001 From: Eric Briand Date: Mon, 15 Oct 2018 13:36:40 +0200 Subject: [PATCH] gcp: validate if project name is filled Signed-off-by: Eric Briand --- src/cmd/linuxkit/gcp.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmd/linuxkit/gcp.go b/src/cmd/linuxkit/gcp.go index 1697a312d..f014f36aa 100644 --- a/src/cmd/linuxkit/gcp.go +++ b/src/cmd/linuxkit/gcp.go @@ -38,6 +38,9 @@ func NewGCPClient(keys, projectName string) (*GCPClient, error) { log.Debugf("Connecting to GCP") ctx := context.Background() var client *GCPClient + if projectName == "" { + return nil, fmt.Errorf("the project name is not specified") + } if keys != "" { log.Debugf("Using Keys %s", keys) f, err := os.Open(keys) @@ -63,7 +66,7 @@ func NewGCPClient(keys, projectName string) (*GCPClient, error) { projectName: projectName, } } else { - log.Debugf("Using Application Default crednetials") + log.Debugf("Using Application Default credentials") gc, err := google.DefaultClient( ctx, storage.DevstorageReadWriteScope,