Exemple #1
0
 def db_command(self, cmd, dbname):
     # try without auth first if server allows it (i.e. version >= 3.0.0)
     if self.try_on_auth_failures():
         need_auth = False
     else:
         need_auth = self.command_needs_auth(dbname, cmd)
     db = self.get_db(dbname, no_auth=not need_auth)
     try:
         return db.command(cmd)
     except (RuntimeError,Exception), e:
         if is_auth_error(e) and self.try_on_auth_failures():
             db = self.get_db(dbname, no_auth=False)
             return db.command(cmd)
         else:
             raise
Exemple #2
0
 def db_command(self, cmd, dbname):
     # try without auth first if server allows it (i.e. version >= 3.0.0)
     if self.try_on_auth_failures():
         need_auth = False
     else:
         need_auth = self.command_needs_auth(dbname, cmd)
     log_verbose("Server '%s': DB Command requested on db %s, need auth ? %s, command: %s" %
                 (self.id, dbname, need_auth, document_pretty_string(cmd)))
     db = self.get_db(dbname, no_auth=not need_auth)
     try:
         return db.command(cmd)
     except (RuntimeError,Exception), e:
         if is_auth_error(e) and self.try_on_auth_failures():
             db = self.get_db(dbname, no_auth=False)
             return db.command(cmd)
         else:
             raise
Exemple #3
0
 def db_command(self, cmd, dbname):
     # try without auth first if server allows it (i.e. version >= 3.0.0)
     if self.try_on_auth_failures():
         need_auth = False
     else:
         need_auth = self.command_needs_auth(dbname, cmd)
     log_verbose("Server '%s': DB Command requested on db %s, need auth ? %s, command: %s" %
                 (self.id, dbname, need_auth, document_pretty_string(cmd)))
     db = self.get_db(dbname, no_auth=not need_auth)
     try:
         return db.command(cmd)
     except (RuntimeError,Exception), e:
         if is_auth_error(e) and self.try_on_auth_failures():
             db = self.get_db(dbname, no_auth=False)
             return db.command(cmd)
         else:
             raise