From 731a7f187f15c0bfa82474f5a9ec8edf090b6794 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 0ed4fe61c..eab8dc98c 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"] }