allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hei...@apache.org
Subject [1/2] allura git commit: [#8038] mongo 3 raises error when calling index_information() on non-existant collection/db
Date Mon, 18 Jan 2016 15:33:39 GMT
Repository: allura
Updated Branches:
  refs/heads/master 7c931628f -> 26799a11b


[#8038] mongo 3 raises error when calling index_information() on non-existant collection/db


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/4d016ae9
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/4d016ae9
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/4d016ae9

Branch: refs/heads/master
Commit: 4d016ae9ec0a3c35ae5becf87cb8644e7a965fa3
Parents: 7c93162
Author: Dave Brondsema <dave@brondsema.net>
Authored: Tue Jan 12 09:54:31 2016 -0500
Committer: Heith Seewald <heiths@gmail.com>
Committed: Mon Jan 18 10:16:14 2016 -0500

----------------------------------------------------------------------
 Allura/allura/command/show_models.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/4d016ae9/Allura/allura/command/show_models.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/show_models.py b/Allura/allura/command/show_models.py
index 917f516..95f362b 100644
--- a/Allura/allura/command/show_models.py
+++ b/Allura/allura/command/show_models.py
@@ -22,7 +22,7 @@ from itertools import groupby
 
 from paste.deploy.converters import asbool
 from pylons import tmpl_context as c, app_globals as g
-from pymongo.errors import DuplicateKeyError, InvalidDocument
+from pymongo.errors import DuplicateKeyError, InvalidDocument, OperationFailure
 
 from ming.orm import mapper, session, Mapper
 from ming.orm.declarative import MappedClass
@@ -257,7 +257,12 @@ class EnsureIndexCommand(base.Command):
         prev_uindexes = {}
         unique_flag_drop = {}
         unique_flag_add = {}
-        for iname, fields in collection.index_information().iteritems():
+        try:
+            existing_indexes = collection.index_information().iteritems()
+        except OperationFailure:
+            # exception is raised if db or collection doesn't exist yet
+            existing_indexes = {}
+        for iname, fields in existing_indexes:
             if iname == '_id_':
                 continue
             keys = tuple(fields['key'])


Mime
View raw message