From ddadfbc993e17c9228cf30d69978f697a3c02b2a Mon Sep 17 00:00:00 2001 From: "n.fraison" Date: Mon, 6 Apr 2020 17:38:55 +0200 Subject: [PATCH] ceph: remove leading and trailing space from get config Value returned by ceph config get can contains some trailing space which leads to issues when running other ceph command. For ex.: 2020-04-06 15:32:43.543050 I | exec: Running command: ceph osd pool set test-1.rgw.control pg_num_min 8 --connect-timeout=15 --cluster=rook-ceph --conf=/var/lib/rook/rook-ceph/rook-ceph.config --keyring=/var/lib/rook/rook-ceph/client.admin.keyring --format json --out-file /tmp/249563089 2020-04-06 15:32:44.005018 I | exec: Error EINVAL: error parsing int value '8 Signed-off-by: n.fraison --- pkg/operator/ceph/config/monstore.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/operator/ceph/config/monstore.go b/pkg/operator/ceph/config/monstore.go index c1fe4fe2b..685621a6e 100644 --- a/pkg/operator/ceph/config/monstore.go +++ b/pkg/operator/ceph/config/monstore.go @@ -20,6 +20,7 @@ import ( "github.com/pkg/errors" "github.com/rook/rook/pkg/clusterd" "github.com/rook/rook/pkg/daemon/ceph/client" + "strings" ) // MonStore provides methods for setting Ceph configurations in the centralized mon @@ -71,7 +72,7 @@ func (m *MonStore) Get(who, option string) (string, error) { if err != nil { return "", errors.Wrapf(err, "failed to get config setting %q for user %q", option, who) } - return string(out), nil + return strings.TrimSpace(string(out)), nil } // SetAll sets all configs from the overrides in the centralized mon configuration database.