mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 01:59:07 +00:00
gcp: validate if project name is filled
Signed-off-by: Eric Briand <eric.briand@gmail.com>
This commit is contained in:
parent
34b1b2207f
commit
b15d0963f4
@ -38,6 +38,9 @@ func NewGCPClient(keys, projectName string) (*GCPClient, error) {
|
|||||||
log.Debugf("Connecting to GCP")
|
log.Debugf("Connecting to GCP")
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
var client *GCPClient
|
var client *GCPClient
|
||||||
|
if projectName == "" {
|
||||||
|
return nil, fmt.Errorf("the project name is not specified")
|
||||||
|
}
|
||||||
if keys != "" {
|
if keys != "" {
|
||||||
log.Debugf("Using Keys %s", keys)
|
log.Debugf("Using Keys %s", keys)
|
||||||
f, err := os.Open(keys)
|
f, err := os.Open(keys)
|
||||||
@ -63,7 +66,7 @@ func NewGCPClient(keys, projectName string) (*GCPClient, error) {
|
|||||||
projectName: projectName,
|
projectName: projectName,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Debugf("Using Application Default crednetials")
|
log.Debugf("Using Application Default credentials")
|
||||||
gc, err := google.DefaultClient(
|
gc, err := google.DefaultClient(
|
||||||
ctx,
|
ctx,
|
||||||
storage.DevstorageReadWriteScope,
|
storage.DevstorageReadWriteScope,
|
||||||
|
Loading…
Reference in New Issue
Block a user