Merge "make metadata indexing optional"

This commit is contained in:
Zuul 2024-11-20 09:44:32 +00:00 committed by Gerrit Code Review
commit 64ba133a57
3 changed files with 16 additions and 18 deletions

View File

@ -73,22 +73,20 @@ class Elastic(object):
return json_data
def combine_metadata(self, result):
if (self.config['elasticsearch']['metadata_files'] is not None and
len(self.config['elasticsearch']['metadata_files']) > 0):
meta = self.config['elasticsearch']['metadata_files']
for _meta in meta:
try:
with open(_meta['file']) as jdata:
result[_meta['name']] = json.load(jdata)
except Exception:
self.logger.error(
"Error loading Metadata file : {}".format(
_meta['file']))
self.logger.error(
"Please make sure the metadata file exists and"
" is valid JSON or run the playbook ansible/gather/site.yml"
" before running the Browbeat test Suite")
sys.exit(1)
meta = self.config['elasticsearch'].get('metadata_files', []) or []
for _meta in meta:
try:
with open(_meta['file']) as jdata:
result[_meta['name']] = json.load(jdata)
except Exception:
self.logger.error(
"Error loading Metadata file : {}".format(
_meta['file']))
self.logger.error(
"Please make sure the metadata file exists and"
" is valid JSON or run the playbook ansible/gather/site.yml"
" before running the Browbeat test Suite")
sys.exit(1)
return result
# Used to transform the cache dict into an elastic insertable iterable

View File

@ -62,7 +62,7 @@ mapping:
required: True
metadata_files:
type: seq
required: True
required: False
sequence:
- type: map
mapping:

View File

@ -70,7 +70,7 @@ class Tools(object):
workloads.run_workload(copy.deepcopy(workload), run_iteration)
def check_metadata(self):
meta = self.config['elasticsearch']['metadata_files']
meta = self.config['elasticsearch'].get('metadata_files', []) or []
for _meta in meta:
if not os.path.isfile(_meta['file']):
self.logger.info(