From 2e46f30d1ec218563de0a6dff081517b15e2c746 Mon Sep 17 00:00:00 2001 From: Arthur Outhenin-Chalandre Date: Fri, 24 Jun 2022 15:47:31 +0200 Subject: [PATCH] config: do not shutdown conn if not yet connected Signed-off-by: Arthur Outhenin-Chalandre --- ceph/config.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ceph/config.go b/ceph/config.go index d3d3a04..ae8469d 100644 --- a/ceph/config.go +++ b/ceph/config.go @@ -32,13 +32,11 @@ func (config *Config) GetCephConnection() (*rados.Conn, error) { conn, err = rados.NewConn() } if err != nil { - conn.Shutdown() return nil, err } if config.ConfigPath != "" { if err = conn.ReadConfigFile(config.ConfigPath); err != nil { - conn.Shutdown() return nil, err } } else { @@ -47,14 +45,12 @@ func (config *Config) GetCephConnection() (*rados.Conn, error) { if config.MonHost != "" { if err = conn.SetConfigOption("mon_host", config.MonHost); err != nil { - conn.Shutdown() return nil, err } } if config.Key != "" { if err = conn.SetConfigOption("key", config.Key); err != nil { - conn.Shutdown() return nil, err } } @@ -62,7 +58,6 @@ func (config *Config) GetCephConnection() (*rados.Conn, error) { if config.Keyring != "" { keyringFile, err := ioutil.TempFile("", "terraform-provider-ceph") if err != nil { - conn.Shutdown() return nil, err } defer os.Remove(keyringFile.Name()) @@ -71,15 +66,12 @@ func (config *Config) GetCephConnection() (*rados.Conn, error) { return nil, err } if _, err = keyringFile.WriteString(config.Keyring); err != nil { - conn.Shutdown() return nil, err } } if err = conn.Connect(); err == nil { config.RadosConn = conn - } else { - conn.Shutdown() } return conn, err }