summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Kleinman <samk@10gen.com>2015-06-03 13:36:28 -0400
committerSam Kleinman <samk@10gen.com>2015-06-03 13:49:56 -0400
commit12ee0ef37a3c5d742f5bb29f96654155358f2eb4 (patch)
tree236f036aa2e4181de7fa9a7394e94c03c8c8787e
parentb8c1c49b36abfa2c49cb15a6f1ac4cadaf2a5648 (diff)
downloadmongo-12ee0ef37a3c5d742f5bb29f96654155358f2eb4.tar.gz
SERVER-18795: provide better printReplicationInfo error message for abiters
-rw-r--r--src/mongo/shell/db.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js
index fdf67eaf728..4ccccded88d 100644
--- a/src/mongo/shell/db.js
+++ b/src/mongo/shell/db.js
@@ -746,7 +746,12 @@ DB.prototype.getReplicationInfo = function() {
DB.prototype.printReplicationInfo = function() {
var result = this.getReplicationInfo();
if( result.errmsg ) {
- if (!this.isMaster().ismaster) {
+ var isMaster = this.isMaster();
+ if (isMaster.arbiterOnly) {
+ print("cannot provide replication status from an arbiter.");
+ return;
+ }
+ else if (!isMaster.ismaster) {
print("this is a slave, printing slave replication info.");
this.printSlaveReplicationInfo();
return;