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

View File

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

View File

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