def osconfig_load(sites): """ Load disk drive data :param sites: provides access to the config directory structure :return: the device size data """ drive_configurations = DriveConfigurations() for cloud, control_plane in sites.control_planes(): osconfig_dir = sites.path(cloud, control_plane).get('osconfig') for host in os.listdir(osconfig_dir): filename = os.path.join(osconfig_dir, host, 'drive_configuration.yml') if os.path.exists(filename): try: with open(filename) as fd: model_in_file = safe_load(fd) drive_configuration = DriveConfiguration() items = model_in_file.get('ardana_drive_configuration', []) for item in items: drive_configuration.load_model(item) drive_configurations.add(drive_configuration) except (IOError, scanner.ScannerError) as err: sys.exit('ERROR reading/parsing: %s' % err) return drive_configurations
def dummy_osconfig_load(text): model = safe_load(text) drive_configurations = DriveConfigurations() for dc_model in model.get('ardana_drive_configuration'): drive_configuration = DriveConfiguration() drive_configuration.load_model(dc_model) drive_configurations.add(drive_configuration) return drive_configurations
def dummy_osconfig_load(text): model = safe_load(text) drive_configurations = DriveConfigurations() for dc_model in model.get('hlm_drive_configuration'): drive_configuration = DriveConfiguration() drive_configuration.load_model(dc_model) drive_configurations.add(drive_configuration) return drive_configurations
def osconfig_load(osconfig_dir): drive_configurations = DriveConfigurations() for host in os.listdir(osconfig_dir): filename = os.path.join(osconfig_dir, host, 'drive_configuration.yml') if os.path.exists(filename): with open(filename) as fd: try: model_in_file = safe_load(fd) drive_configuration = DriveConfiguration() items = model_in_file.get('hlm_drive_configuration', []) for item in items: drive_configuration.load_model(item) drive_configurations.add(drive_configuration) except IOError as err: print('ERROR: %s' % err) sys.exit(1) return drive_configurations