diff options
author | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2017-09-26 03:42:24 +0200 |
---|---|---|
committer | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2017-12-13 22:39:58 +0000 |
commit | 65482c5f30dc3a48584155c919fca71a5d943a5a (patch) | |
tree | 5ba68e90fd76944c1d5b4b98fd7308962fc464ad | |
parent | 3a8defe6ca168b2a7739ff4fb64543da10f2b3e7 (diff) |
PDF: generate_config: Add IDF parsing support
For a given 'podN.yaml' file, check whether a file named
'idf-podN.yaml' exists in the same directory, and if it does,
pass its contents under the 'idf' dict key to the j2 template.
This assumes the contents of IDF yaml have a root 'idf' key.
Change-Id: I6c6f1b9f28c38989f8a6ed4a389c9a1da423d76d
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
(cherry picked from commit e5c76e735a99395ab075f95c0f4105f8727a834e)
-rwxr-xr-x | config/utils/generate_config.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/config/utils/generate_config.py b/config/utils/generate_config.py index a32367af..18af98db 100755 --- a/config/utils/generate_config.py +++ b/config/utils/generate_config.py @@ -2,6 +2,7 @@ """This module does blah blah.""" import argparse import ipaddress +import os import yaml from jinja2 import Environment, FileSystemLoader @@ -44,6 +45,13 @@ ENV.filters['dpkg_arch'] = dpkg_arch with open(ARGS.yaml) as _: DICT = yaml.safe_load(_) +# If an installer descriptor file (IDF) exists, include it (temporary) +IDF_PATH = '/idf-'.join(os.path.split(ARGS.yaml)) +if os.path.exists(IDF_PATH): + with open(IDF_PATH) as _: + IDF = yaml.safe_load(_) + DICT['idf'] = IDF['idf'] + # Print dictionary generated from yaml (uncomment for debug) # print(DICT) |