Skip to content

Commit 4f7ba95

Browse files
jameseh96owend74
authored andcommitted
MB-45684: Fix cbstats stats_key and stats_vkey error messages
The exception is now printed rather than hitting an AttributeError. e.g., Memcached error #1: KEY_ENOENT : Not Found : Rather than the previous: Traceback (most recent call last): File ".../engines/ep/management/cbstats", line 539, in stats_key vbs = mc.stats(cmd) File ".../engines/ep/management/mc_bin_client.py", line 636, in stats cmd, opaque, cas, klen, extralen, data = self._handleKeyedResponse(None) File ".../engines/ep/management/mc_bin_client.py", line 292, in _handleKeyedResponse raise MemcachedError(errcode, msg) mc_bin_client.ErrorKeyEnoent: Memcached error #1: KEY_ENOENT : Not Found : During handling of the above exception, another exception occurred: Traceback (most recent call last): File ".../engines/ep/management/cbstats", line 1010, in <module> main() File ".../engines/ep/management/cbstats", line 1007, in main c.execute() File ".../engines/ep/management/clitool.py", line 83, in execute f[0](mc, *args[2:], **opts.__dict__) File ".../engines/ep/management/cbstats", line 49, in g f(*args, **kwargs) File ".../engines/ep/management/cli_auth_utils.py", line 106, in g f(*args, **kwargs) File ".../engines/ep/management/cbstats", line 541, in stats_key print(e.message) AttributeError: 'ErrorKeyEnoent' object has no attribute 'message' Change-Id: Iae887189b485e1c62dd5f5ceba599e0660502067 Reviewed-on: http://review.couchbase.org/c/kv_engine/+/151234 Reviewed-by: Daniel Owen <[email protected]> Tested-by: James Harrison <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent 8723f19 commit 4f7ba95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

engines/ep/management/cbstats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def stats_key(mc, key, vb, *args):
538538
print(cmd)
539539
vbs = mc.stats(cmd)
540540
except mc_bin_client.MemcachedError as e:
541-
print(e.message)
541+
print(e)
542542
sys.exit(1)
543543
except ValueError as e:
544544
print("Failed to parse collection: %s" % str(e))
@@ -563,7 +563,7 @@ def stats_vkey(mc, key, vb, *args):
563563
cmd = "%s %s %s %s" % (requestStatKey, key, str(vb), collection)
564564
vbs = mc.stats(cmd)
565565
except mc_bin_client.MemcachedError as e:
566-
print(e.message)
566+
print(e)
567567
sys.exit(1)
568568
except ValueError as e:
569569
print("Failed to parse collection: %s" % str(e))

0 commit comments

Comments
 (0)