def _read_config(self):
        self.hosts = []
        try:
            if os.path.exists(self.config_path):
                cfgfile = open(self.config_path, 'r')
                self.settings = yaml.safe_load(cfgfile.read())
                cfgfile.close()

                # Use the presence of a Description as an indicator this is
                # a legacy config file:
                if 'Description' in self.settings:
                    self._upgrade_legacy_config()

                # Parse the hosts into DTO objects:
                if 'hosts' in self.settings:
                    for host in self.settings['hosts']:
                        self.hosts.append(Host(**host))

                # Watchout for the variant_version coming in as a float:
                if 'variant_version' in self.settings:
                    self.settings['variant_version'] = \
                        str(self.settings['variant_version'])

        except __HOLE__, ferr:
            raise OOConfigFileError('Cannot open config file "{}": {}'.format(ferr.filename,
                                                                              ferr.strerror))
        except yaml.scanner.ScannerError:
            raise OOConfigFileError(
                'Config file "{}" is not a valid YAML document'.format(self.config_path))
dataset/ETHPy150Open openshift/openshift-ansible/utils/src/ooinstall/oo_config.py/OOConfig._read_config