Add dynamically captured version data to metadata

Currently the user had to manually change version.json to reflect the
environment in which the user is running browbeat. This commit adds functionality
for browbeat to consume OSP version data captured from stockpile and ship it ES
along with result data, as metadata.

Change-Id: Ic8036914046aa19680abf491683bb9cd141875ff
This commit is contained in:
Sai Sindhur Malleni 2020-03-02 15:35:41 -05:00
parent d6bba83c90
commit 88cf6fc4f0
2 changed files with 16 additions and 4 deletions

View File

@ -80,6 +80,19 @@ class Metadata(object):
env_dict['environment_setup'][nodes] = number
return env_dict
def get_version_metadata(self, sys_data):
version = {}
for item, dictionary in six.iteritems(sys_data):
if 'undercloud' in sys_data[item]['group_names']:
if 'stockpile_rhosp_version' in dictionary:
version['rhosp_version'] = dictionary['stockpile_rhosp_version']
if 'stockpile_rhosp_major' in dictionary:
version['rhosp_major'] = dictionary['stockpile_rhosp_major']
if 'stockpile_rhosp_puddle' in dictionary:
version['rhosp_puddle'] = dictionary['stockpile_rhosp_puddle']
break
return version
def get_software_metadata(self, sys_data):
soft_all_dict = []
bad_output_list = [{},[],""]
@ -182,6 +195,9 @@ def main():
hardware_data = metadata.get_hardware_metadata(sysdata)
metadata.write_metadata_file(
hardware_data, os.path.join(args.path, 'hardware-metadata.json'))
version_data = metadata.get_version_metadata(sysdata)
metadata.write_metadata_file(
version_data, os.path.join(args.path, 'version.json'))
software_data = metadata.get_software_metadata(sysdata)
# Just a simple check to ensure that stockpile was able to collect osp data
check = False

View File

@ -1,4 +0,0 @@
{
"osp_series": "rocky",
"build": "2018-XX-XX.X"
}