Use yaml instead of parsing the text

The gnocchi.yml is YAML formatted, so it's easier to use yaml
to load data, vs parsing it as a text file.

YAML is installed in the venv anyway, so it comes for free.

Change-Id: I98c48820827087890a6c1a7391acf479c89142c5
This commit is contained in:
Jean-Philippe Evrard 2019-01-12 13:43:02 +01:00
parent 06e28ec5d2
commit cc58bfe342
1 changed files with 3 additions and 2 deletions

View File

@ -29,6 +29,7 @@ import sys
import subprocess
import openstackdocstheme
import yaml
# -- OpenStack-Ansible configuration --------------------------------------
# Variables to override
@ -62,8 +63,8 @@ else:
CONF_PATH = os.path.dirname(os.path.realpath(__file__))
GNOCCHI_DETAILS = '../../playbooks/defaults/repo_packages/gnocchi.yml'
with open(os.path.join(CONF_PATH, GNOCCHI_DETAILS), 'r') as fdesc:
result = re.search('gnocchi_git_install_branch:.*# HEAD of "(.*)".*', fdesc.read())
gnocchi_branch = result.groups()[0]
gnocchi_file_content = yaml.safe_load(fdesc)
gnocchi_branch = gnocchi_file_content['gnocchi_git_track_branch']
# References variable for substitutions
upgrade_backup_dir = "``/etc/openstack_deploy.{branchname}``".format(branchname=previous_series_name.upper())