fixed bug where the project name was not being read from configuration if it was provided via the "tenant" attribute. this was causing the swift client to crash with an EOF error. (#2803)

This commit is contained in:
Mevan Samaratunga 2017-06-05 16:48:39 +02:00 committed by Jeff Mitchell
parent 898d3f12fe
commit 731a7f187f
1 changed files with 4 additions and 4 deletions

View File

@ -30,6 +30,8 @@ type SwiftBackend struct {
// from the environment.
func newSwiftBackend(conf map[string]string, logger log.Logger) (Backend, error) {
var ok bool
username := os.Getenv("OS_USERNAME")
if username == "" {
username = conf["username"]
@ -60,11 +62,9 @@ func newSwiftBackend(conf map[string]string, logger log.Logger) (Backend, error)
}
project := os.Getenv("OS_PROJECT_NAME")
if project == "" {
project = conf["project"]
if project == "" {
if project, ok = conf["project"]; !ok {
// Check for KeyStone naming prior to V3
project := os.Getenv("OS_TENANT_NAME")
project = os.Getenv("OS_TENANT_NAME")
if project == "" {
project = conf["tenant"]
}