[autotest] Skip alias update if reindex was not completed.
BUG=None
TEST=None
Change-Id: Ic08b2db7cb5973ff68c369f894b8394864d95a29
Reviewed-on: https://chromium-review.googlesource.com/225650
Commit-Queue: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
diff --git a/site_utils/es_reindex.py b/site_utils/es_reindex.py
index 0bc5a71..887a207 100755
--- a/site_utils/es_reindex.py
+++ b/site_utils/es_reindex.py
@@ -70,10 +70,10 @@
# count_new can be larger than count if new records are added during
# reindexing. This check only tries to make sure no record was lost.
if count > count_new:
- print ('Error! There are %d records missing after reindexing. Alias '
- 'will not be updated to the new index. You might want to try '
- 'reindex again.' %
- (count - count_new))
+ raise Exception('Error! There are %d records missing after reindexing. '
+ 'Alias will not be updated to the new index. You might '
+ 'want to try reindex again.' %
+ (count - count_new))
body = {'actions': [{'remove': {'alias': options.alias,
'index': options.old}},