fix bug when azure cloud provider configuration file is not specified

This commit is contained in:
Di Xu 2017-07-20 17:29:09 +08:00
parent acc19cafa4
commit 2cddfd0db9

View File

@ -327,6 +327,11 @@ func NewCloud(configReader io.Reader) (cloudprovider.Interface, error) {
// ParseConfig returns a parsed configuration and azure.Environment for an Azure cloudprovider config file
func ParseConfig(configReader io.Reader) (*Config, *azure.Environment, error) {
var config Config
var env azure.Environment
if configReader == nil {
return &config, &env, nil
}
configContents, err := ioutil.ReadAll(configReader)
if err != nil {
@ -337,7 +342,6 @@ func ParseConfig(configReader io.Reader) (*Config, *azure.Environment, error) {
return nil, nil, err
}
var env azure.Environment
if config.Cloud == "" {
env = azure.PublicCloud
} else {