From f140d7905c37d668a8dc3957104b0c5928a186bc Mon Sep 17 00:00:00 2001 From: Claudius Heine Date: Fri, 13 Oct 2017 12:20:06 +0200 Subject: [PATCH] config: includehandler: remove other checks that are no longer needed Using the jsonschema module makes some checks in the includehandler redundant and can be removed. This patch does this. Signed-off-by: Claudius Heine --- kas/includehandler.py | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/kas/includehandler.py b/kas/includehandler.py index 15201bf..792c87a 100644 --- a/kas/includehandler.py +++ b/kas/includehandler.py @@ -77,30 +77,12 @@ def load_config(filename): 'config file %s', filename) try: - header = config.get('header', {}) - except AttributeError: - raise LoadConfigException('Config does not contain a dictionary', - filename) - - if not header: - raise LoadConfigException('Header missing or empty', filename) - - try: - version = header.get('version', None) - except AttributeError: - raise LoadConfigException('Header is not a dictionary', filename) - - if not version: - raise LoadConfigException('Version missing or empty', filename) - - try: - version_value = int(version) + version_value = int(config['header']['version']) except ValueError: # Be compatible: version string '0.10' is equivalent to file version 1 - if isinstance(version, str) and version == '0.10': - version_value = 1 - else: - raise LoadConfigException('Unexpected version format', filename) + # This check is already done in the config schema so here just set the + # right version + version_value = 1 if version_value < __compatible_file_version__ or \ version_value > __file_version__: