Attempting to fix test runs if no aliases exist

This commit is contained in:
Rob Hudson 2013-05-22 08:13:59 -07:00
Родитель 6999d04379
Коммит 3bf14e719e
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -698,15 +698,19 @@ class ESTestCase(TestCase):
raise
for index in set(settings.ES_INDEXES.values()):
# getting the index that's pointed by the alias
# Get the index that's pointed to by the alias.
try:
indices = cls.es.get_alias(index)
index = indices[0]
except IndexError:
# There's no alias, just use the index.
print 'Found no alias for %s.' % index
index = index
except (pyes.IndexMissingException,
pyelasticsearch.ElasticHttpNotFoundError):
pass
# this removes any alias as well
# Remove any alias as well.
try:
cls.es.delete_index(index)
except (pyes.IndexMissingException,