'Parse an entry and add it to the given SudoersConfig rdfvalue.'

def _ParseSudoersEntry(self, entry, sudoers_config):

    key = entry[0]
    if (key in SudoersParser.ALIAS_TYPES.keys()):
        alias_entry = rdf_config_file.SudoersAlias(type=SudoersParser.ALIAS_TYPES.get(key), name=entry[1])
        (members, _) = self._ExtractList(entry[2:], ignores=(',', '='))
        field = SudoersParser.ALIAS_FIELDS.get(key)
        getattr(alias_entry, field).Extend(members)
        sudoers_config.aliases.append(alias_entry)
    elif key.startswith(SudoersParser.DEFAULTS_KEY):
        scope = None
        if (len(key) > len(SudoersParser.DEFAULTS_KEY)):
            scope = key[(len(SudoersParser.DEFAULTS_KEY) + 1):]
        entry = entry[1:]
        (defaults, _) = self._ExtractList(entry)
        for default in defaults:
            default_entry = rdf_config_file.SudoersDefault(scope=scope)
            default_name = default
            value = []
            if ('=' in default_name):
                (default_name, remainder) = default_name.split('=', 1)
                value = [remainder]
            default_entry.name = default_name
            if entry:
                default_entry.value = '    '.join(value)
            sudoers_config.defaults.append(default_entry)
    elif (key in SudoersParser.INCLUDE_KEYS):
        target = '    '.join(entry[1:])
        sudoers_config.includes.append(target)
    else:
        (users, entry) = self._ExtractList(entry)
        (hosts, entry) = self._ExtractList(entry, terminators=('=',))
        if (entry[0] == '='):
            entry = entry[1:]
        sudoers_entry = rdf_config_file.SudoersEntry(users=users, hosts=hosts, cmdspec=entry)
        sudoers_config.entries.append(sudoers_entry)
