Avoid panic when cluster not found

Based on the stack trace in #3011

Fix #3011
This commit is contained in:
Justin Santa Barbara 2017-07-23 23:21:50 -04:00
parent e8d2aa3d64
commit c537c7271c
1 changed files with 4 additions and 0 deletions

View File

@ -90,6 +90,10 @@ func RunGetInstanceGroups(options *GetInstanceGroupsOptions, args []string) erro
return fmt.Errorf("error fetching cluster %q: %v", clusterName, err)
}
if cluster == nil {
return fmt.Errorf("cluster %q was not found", clusterName)
}
list, err := clientset.InstanceGroupsFor(cluster).List(metav1.ListOptions{})
if err != nil {
return err