def read_sources(sources_yaml): """Read boot resources config file. :param sources_yaml: Path to a YAML file containing a list of boot resource definitions. :return: A dict representing the boot-resources configuration. :raise NoConfigFile: If the configuration file was not present. """ # The config file is required. We do not fall back to defaults if it's # not there. try: return BootSources.load(filename=sources_yaml) except IOError as ex: if ex.errno == errno.ENOENT: # No config file. We have helpful error output for this. raise NoConfigFile(ex) else: # Unexpected error. raise
def parse_sources(sources_yaml): """Given a YAML `config` string, return a `BootSources` for it.""" return BootSources.parse(StringIO(sources_yaml))