X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Flcm.py;h=5638943c6fb01bd934bf653355fbe30a402e7cb5;hb=a89a5a7e3b0421a5ae1859235dfef6b6adf24279;hp=9f0e31061a7a36c1e91ceedeb2cd80c0a35cb0bb;hpb=a27dc53c6acd967ea17f0d720a82b23a8404cbfa;p=osm%2FLCM.git diff --git a/osm_lcm/lcm.py b/osm_lcm/lcm.py index 9f0e310..5638943 100644 --- a/osm_lcm/lcm.py +++ b/osm_lcm/lcm.py @@ -28,7 +28,6 @@ import logging import logging.handlers import getopt import sys -import configparser from osm_lcm import ns, vim_sdn, netslice from osm_lcm.ng_ro import NgRoException, NgRoClient @@ -750,37 +749,12 @@ class Lcm: self.fs.fs_disconnect() def read_config_file(self, config_file): - # TODO make a [ini] + yaml inside parser - # the configparser library is not suitable, because it does not admit comments at the end of line, - # and not parse integer or boolean - conf = {} try: - # read file as yaml format - config = configparser.ConfigParser(inline_comment_prefixes="#") - config.read(config_file) - conf = {s: dict(config.items(s)) for s in config.sections()} + with open(config_file) as f: + return yaml.safe_load(f) except Exception as e: self.logger.critical("At config file '{}': {}".format(config_file, e)) - self.logger.critical("Trying to load config as legacy mode") - try: - with open(config_file) as f: - conf = yaml.safe_load(f) - # Ensure all sections are not empty - for k in ( - "global", - "timeout", - "RO", - "VCA", - "database", - "storage", - "message", - ): - if not conf.get(k): - conf[k] = {} - except Exception as e: - self.logger.critical("At config file '{}': {}".format(config_file, e)) - exit(1) - return conf + exit(1) @staticmethod def get_process_id():