From e69aea66ea5ba941e25eb42508e43e4670820cbd Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Wed, 2 Oct 2019 10:52:40 -0400 Subject: [PATCH] ceph.in: check ceph-conf returncode When running the ceph-conf command, we only check the stderr output. When the ceph configuration file has duplicate values then the ceph daemon command will fail because the stderr will contain the warning message but the ceph-conf return code is 0. $ ceph-conf --name mon.cephaio-1 --show-config-value admin_socket warning: line 13: 'osd_memory_target' in section 'osd' redefined /var/run/ceph/ceph-mon.cephaio-1.asok $ echo $? 0 Fixes: https://tracker.ceph.com/issues/37664 Signed-off-by: Dimitri Savineau --- src/ceph.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ceph.in b/src/ceph.in index fac4ce3f06e9..ce6ce109f62b 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -524,7 +524,7 @@ def ceph_conf(parsed_args, field, name): stdout=subprocess.PIPE, stderr=subprocess.PIPE) outdata, errdata = p.communicate() - if len(errdata): + if p.returncode != 0: raise RuntimeError('unable to get conf option %s for %s: %s' % (field, name, errdata)) return outdata.rstrip() -- 2.47.3