From 65b9c35229ea4d22ae157afb6a07206b26213dec Mon Sep 17 00:00:00 2001 From: Mevan Samaratunga Date: Mon, 5 Jun 2017 16:48:39 +0200 Subject: [PATCH] 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) --- physical/swift.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/physical/swift.go b/physical/swift.go index 0ed4fe61cf6a..eab8dc98cbc8 100644 --- a/physical/swift.go +++ b/physical/swift.go @@ -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"] }