AWS: Support default for ExternalHost on AWS

Fix #33563
This commit is contained in:
Justin Santa Barbara 2016-09-27 11:15:35 -04:00
parent 3e3ff447d2
commit 2c7771e90c

View File

@ -503,14 +503,14 @@ func DefaultAndValidateRunOptions(options *options.ServerRunOptions) {
// Set default value for ExternalHost if not specified.
if len(options.ExternalHost) == 0 {
// TODO: extend for other providers
if options.CloudProvider == "gce" {
if options.CloudProvider == "gce" || options.CloudProvider == "aws" {
cloud, err := cloudprovider.InitCloudProvider(options.CloudProvider, options.CloudConfigFile)
if err != nil {
glog.Fatalf("Cloud provider could not be initialized: %v", err)
}
instances, supported := cloud.Instances()
if !supported {
glog.Fatalf("GCE cloud provider has no instances. this shouldn't happen. exiting.")
glog.Fatalf("%q cloud provider has no instances. this shouldn't happen. exiting.", options.CloudProvider)
}
hostname, err := os.Hostname()
if err != nil {