Commit 4d03ea44 authored by David Danier's avatar David Danier

Empty YAML file will return None

parent 7de1d8d6
......@@ -20,24 +20,22 @@ def find_configs(state, configs):
class ConfigHandler:
def load(self, run_path, file_paths):
full_config = {}
for file_path in file_paths:
loaded_config = self.load_config_file(run_path, file_path)
full_config = ConfigHandler.merge_config(full_config, loaded_config)
if loaded_config: # Empty YAML file will return None
full_config = ConfigHandler.merge_config(full_config, loaded_config)
return self.validate_config(full_config)
def load_config_file(self, run_path, file_path):
config_path = os.path.join(run_path, os.path.expanduser(file_path))
if os.path.exists(config_path):
file_handle = open(config_path, 'r')
config = yaml.safe_load(file_handle)
return config
return {}
return None # As empty files return None, we may do so here, too ;-)
def validate_config(self, config):
if 'version' in config:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment