def load_systems(self, data_directory): """ Load all the systems in the data data directory """ systems_glob = glob.iglob( os.path.join(data_directory, 'components', '*', 'system.yaml') ) self.systems = {} self.justification_mapping = {} for system_yaml_path in systems_glob: system_dir_path = os.path.split(system_yaml_path)[0] system_key = os.path.split(system_dir_path)[-1] system = System(system_directory=system_dir_path) utils.merge_justification(self.justification_mapping, system.justification_mapping) self.systems[system_key] = system
def load_components_files(self, system_directory): """ Load the components under the system by crawling through the file system and store the data in individual component objects """ components_glob = glob.iglob( os.path.join(system_directory, '*', 'component.yaml') ) self.components = {} self.justification_mapping = {} for component_yaml_path in components_glob: component_dir_path = os.path.split(component_yaml_path)[0] component_key = os.path.split(component_dir_path)[-1] component = Component(component_directory=component_dir_path) utils.merge_justification( self.justification_mapping, component.justification_mapping ) self.components[component_key] = component