From 1447d3ddce0ae17715268cc6513266e91268d1a0 Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 30 Jul 2018 16:30:01 +0100 Subject: [PATCH] ceph.in: friendlier message on EPERM When we get an EPERM, we can make an informed guess at what the problem is. This is a reasonably common user error if they have e.g. "mds allow" instead of "mds allow *", or "osd allow rwx" instead of "osd allow *". Fixes: http://tracker.ceph.com/issues/25172 Signed-off-by: John Spray --- src/ceph.in | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ceph.in b/src/ceph.in index 2a5c640a5356c..ac610d14c3c7c 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -375,8 +375,15 @@ def do_extended_help(parser, args, target, partial): prefix='get_command_descriptions', timeout=10) if ret: - print("couldn't get command descriptions for {0}: {1} ({2})". - format(target, outs, ret), file=sys.stderr) + if ret == -errno.EPERM and target[0] in ('osd', 'mds'): + print("Permission denied. Check that your user has 'allow *' " + "capabilities for the target daemon type.", file=sys.stderr) + elif ret == -errno.EPERM: + print("Permission denied. Check your user has proper " + "capabilities configured", file=sys.stderr) + else: + print("couldn't get command descriptions for {0}: {1} ({2})". + format(target, outs, ret), file=sys.stderr) return ret else: return help_for_sigs(outbuf.decode('utf-8'), partial) -- 2.39.5