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 <n.fraison@criteo.com>
This commit is contained in:
n.fraison committed 2020-04-06 18:14:50 +02:00
1 parent 56707ddcc4
commit ddadfbc993
1 file changed
+2 -1
+2 -1
View File
@@ -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.