Skip to content

Commit

Permalink
OpenStack: Read cloud names from other locations
Browse files Browse the repository at this point in the history
Now we read clouds only from clouds.yaml file, but there are two
other possible locations: clouds-public.yaml and secure.yaml

This patch appends clouds from those files to the list of available
clouds.

Fixes: #2997
  • Loading branch information
Fedosin committed Jan 28, 2020
1 parent 837a311 commit 59ae7a8
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion pkg/asset/installconfig/openstack/realvalidvaluesfetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,33 @@ func NewValidValuesFetcher() validation.ValidValuesFetcher {
return realValidValuesFetcher{}
}

// GetCloudNames gets the valid cloud names. These are read from clouds.yaml.
// GetCloudNames gets the valid cloud names. These are read from clouds.yaml,
// clouds-public.yaml and secure.yaml.
func (f realValidValuesFetcher) GetCloudNames() ([]string, error) {
// Read data from clouds.yaml
clouds, err := new(yamlLoadOpts).LoadCloudsYAML()
if err != nil {
return nil, err
}

// Read data from clouds-public.yaml and append it to clouds
publicClouds, err := new(yamlLoadOpts).LoadPublicCloudsYAML()
if err != nil {
return nil, err
}
for k, v := range publicClouds {
clouds[k] = v
}

// Read data from secure.yaml and append it to clouds
secureClouds, err := new(yamlLoadOpts).LoadSecureCloudsYAML()
if err != nil {
return nil, err
}
for k, v := range secureClouds {
clouds[k] = v
}

i := 0
cloudNames := make([]string, len(clouds))
for k := range clouds {
Expand Down

0 comments on commit 59ae7a8

Please sign in to comment.