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