Skip to content

Commit

Permalink
Read OpenStack creds from standard paths
Browse files Browse the repository at this point in the history
OpenStack creds cold be in 3 different paths (etc, home config and
current dir). Instead of re-implementing the logic to find and read the
clouds.yaml file, we should use gophercloud which is the standard
go library for OpenStack.

Note that deployments on OpenStack are currently broken unless there's
a clouds.yaml under /etc/openstack.

Fixes openshift#550
  • Loading branch information
flaper87 committed Nov 5, 2018
1 parent 1f0779d commit ccd142f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/asset/manifests/tectonic.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/ghodss/yaml"
"github.com/pkg/errors"

"github.com/gophercloud/utils/openstack/clientconfig"
"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/installconfig"
"github.com/openshift/installer/pkg/asset/machines"
Expand All @@ -20,7 +21,6 @@ import (

const (
tectonicManifestDir = "tectonic"
openStackCredsFile = "/etc/openstack/clouds.yaml"
)

var (
Expand Down Expand Up @@ -80,10 +80,17 @@ func (t *Tectonic) Generate(dependencies asset.Parents) error {
},
}
case "openstack":
credsEncoded, err := credsFileEncode(openStackCredsFile)
clouds, err := clientconfig.LoadCloudsYAML()
if err != nil {
return err
}

marshalled, err := yaml.Marshal(clouds)
if err != nil {
return err
}

credsEncoded := base64.StdEncoding.EncodeToString(marshalled)
cloudCreds = cloudCredsSecretData{
OpenStack: &OpenStackCredsSecretData{
Base64encodeCloudCreds: credsEncoded,
Expand Down

0 comments on commit ccd142f

Please sign in to comment.