Skip to content

Commit

Permalink
Use replSetGetConfig only when version is greater than 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul committed Mar 16, 2016
1 parent 03512a1 commit 6964d99
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mongoctl/objects/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@ def has_connectivity_on(self, address):
###########################################################################
def get_rs_config(self):
try:
return self.db_command(SON([('replSetGetConfig', 1)]), "admin")["config"]
if self.version_greater_than_3_0():
return self.db_command(SON([('replSetGetConfig', 1)]), "admin")["config"]
else:
return self.get_db('local')['system.replset'].find_one()
except (Exception,RuntimeError), e:
log_debug("Error whille trying to read rs config from "
"server '%s': %s" % (self.id, e))
Expand Down Expand Up @@ -961,6 +964,10 @@ def supports_local_users(self):

###############################################################################
def try_on_auth_failures(self):
return self.version_greater_than_3_0()

###############################################################################
def version_greater_than_3_0(self):
version = self.get_mongo_version_info()
return version and version >= VERSION_3_0

Expand Down

0 comments on commit 6964d99

Please sign in to comment.