def validate(self): super(EnziConfigValidator, self).validate() # check `enzi_version` enzi_version = self.val['enzi_version'] if not enzi_version in ENZI_CONFIG_VERSIONS: _v = StringValidator(key='enzi_version', val=enzi_version, parent=self) msg = 'unknown enzi_version: {}'.format(enzi_version) raise ValidatorError(_v.chain_keys_str(), msg) # check self dependency if 'dependencies' in self.val: package_name = self.val['package']['name'] if package_name in self.val['dependencies']: fmt = 'Possible self dependency for package: {} at {}' msg = fmt.format(package_name, self.key) logger.error(msg) raise SystemExit(EnziConfigValidator.BASE_ESTRING + msg) return self.val
def validate(self): super(EnziConfigValidator, self).validate() enzi_version = self.val['enzi_version'] if not enzi_version in ENZI_CONFIG_VERSIONS: _v = StringValidator(key='enzi_version', val=enzi_version, parent=self) msg = 'unknown enzi_version: {}'.format(enzi_version) raise ValidatorError(_v.chain_keys_str(), msg) # check if all filesets in the minimal sections exists # in this package's filesets. if 'minimal' in self.val: known_filesets = OrderedSet(self.val['filesets'].keys()) minimal_filesets = OrderedSet(self.val['minimal'].get('filesets')) if not minimal_filesets: self.val['minimal']['filesets'] = known_filesets else: diff = minimal_filesets - known_filesets if diff: k = self.chain_keys_str() + '.minimal.filesets' fmt = 'filesets: {} not exists' msg = fmt.format(list(diff)) raise ValidatorError(k, msg) self.val['minimal']['filesets'] = minimal_filesets # check self dependency if 'dependencies' in self.val: package_name = self.val['package']['name'] if package_name in self.val['dependencies']: fmt = 'Possible self dependency for package: {} at {}' msg = fmt.format(package_name, self.key) logger.error(msg) raise SystemExit(EnziConfigValidator.BASE_ESTRING + msg) return self.val