summaryrefslogtreecommitdiffstats
path: root/utils/test/scripts/mongo_to_elasticsearch.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-06-22 20:46:56 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-06-30 11:15:24 +0800
commitfa07c352a88830c985991b361068778239cb9cab (patch)
treeb9542a570d5a6142250180be75f175f1beaa3a47 /utils/test/scripts/mongo_to_elasticsearch.py
parentb7182381972ff8df6124adc271d9eb9e7a610b27 (diff)
add log info when publish json to elasticsearch failed
add logger.info when publish failed JIRA: FUNCTEST-325 Change-Id: I353001c4305af31dd725e0977ced53d52ba79470 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/scripts/mongo_to_elasticsearch.py')
-rw-r--r--utils/test/scripts/mongo_to_elasticsearch.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/test/scripts/mongo_to_elasticsearch.py b/utils/test/scripts/mongo_to_elasticsearch.py
index a569ac61c..2ffbc1713 100644
--- a/utils/test/scripts/mongo_to_elasticsearch.py
+++ b/utils/test/scripts/mongo_to_elasticsearch.py
@@ -395,7 +395,12 @@ def publish_mongo_data(output_destination):
for mongo_json_line in fobj:
test_result = json.loads(mongo_json_line)
if modify_mongo_entry(test_result):
- shared_utils.publish_json(test_result, es_creds, output_destination)
+ status, data = shared_utils.publish_json(test_result, es_creds, output_destination)
+ if status > 300:
+ project = test_result['project_name']
+ case_name = test_result['case_name']
+ logger.info('project {} case {} publish failed, due to [{}]'
+ .format(project, case_name, json.loads(data)['error']['reason']))
finally:
if os.path.exists(tmp_filename):
os.remove(tmp_filename)