consolidate yaml configuration

workaround ruamel.yaml issue 255,
where once an empty dict or list has been written,
'flow' style is used thereafter, using dense `{key: value}` form
instead of traditional yaml block style.
This commit is contained in:
Min RK
2018-11-01 11:34:16 +01:00
parent d79155380a
commit d331936812
4 changed files with 61 additions and 13 deletions

View File

@@ -13,14 +13,13 @@ tljh-config show firstlevel.second_level
"""
import argparse
from collections import Sequence, Mapping
from copy import deepcopy
import os
import re
import sys
from ruamel.yaml import YAML
from ruamel.yaml.comments import CommentedMap, CommentedSeq
yaml = YAML(typ='rt')
from .yaml import yaml
INSTALL_PREFIX = os.environ.get('TLJH_INSTALL_PREFIX', '/opt/tljh')
@@ -211,11 +210,11 @@ def parse_value(value_str):
def _is_dict(item):
return isinstance(item, (dict, CommentedMap))
return isinstance(item, Mapping)
def _is_list(item):
return isinstance(item, (list, CommentedSeq))
return isinstance(item, Sequence)
def main(argv=None):