Tolerate a missing MasterName (for GKE)

GKE created clusters don't provide a MasterName, so don't
throw a warning and give up when that happens.
pull/6/head
Adam Worrall 2017-07-18 09:55:15 -07:00
parent 6b78eeca84
commit 14091e4043
1 changed files with 9 additions and 6 deletions

View File

@ -162,13 +162,16 @@ func lookupClusterImageSources() (string, string, error) {
frags := strings.Split(nodeImg, "/")
nodeImg = frags[len(frags)-1]
masterName := TestContext.CloudConfig.MasterName
masterImg, err := host2image(masterName)
// For GKE clusters, MasterName will not be defined; we just leave masterImg blank.
masterImg := ""
if masterName := TestContext.CloudConfig.MasterName; masterName != "" {
img, err := host2image(masterName)
if err != nil {
return "", "", err
}
frags = strings.Split(masterImg, "/")
frags = strings.Split(img, "/")
masterImg = frags[len(frags)-1]
}
return masterImg, nodeImg, nil
}