def validate(self, json_path): known_types = set(self.index_customizers).union(self.types_to_skip) errors = False for name in self.import_users: if is_valid_name(name): continue self.xom.log.error( "username '%s' contains characters that aren't allowed. " "Any ascii symbol besides -.@_ is blocked." % name) errors = True for index in self.import_indexes: config = self.import_indexes[index]['indexconfig'] index_type = config['type'] if index_type not in known_types: errors = True self.xom.log.error( "Unknown index type '%s'. " "Did you forget to install the necessary plugin? " "You can also skip these with '--skip-import-type %s'.", index_type, index_type) continue if index_type in self.types_to_skip: continue user, name = index.split('/') if is_valid_name(name): continue self.xom.log.error( "indexname '%s' contains characters that aren't allowed. " "Any ascii symbol besides -.@_ is blocked." % index) errors = True if errors: self.xom.log.warn( "You could also try to edit %s manually to fix the above errors." % json_path) raise SystemExit(1)
def check_names(self, json_path): errors = False for name in self.import_users: if is_valid_name(name): continue self.xom.log.error( "username '%s' contains characters that aren't allowed. " "Any ascii symbol besides -.@_ is blocked." % name) errors = True for index in self.import_indexes: user, name = index.split('/') if is_valid_name(name): continue self.xom.log.error( "indexname '%s' contains characters that aren't allowed. " "Any ascii symbol besides -.@_ is blocked." % index) errors = True if errors: self.xom.log.warn( "You should edit %s manually to fix the above errors." % json_path) raise SystemExit(1)