def ParseMultiple(self, stats, unused_file_obj, unused_kb):
    """Identify the init scripts and the start/stop scripts at each runlevel.

    Evaluate all the stat entries collected from the system.
    If the path name matches a runlevel spec, and if the filename matches a
    sysv init symlink process the link as a service.

    Args:
      stats: An iterator of StatEntry rdfs.
      unused_file_obj: An iterator of file contents. Not needed as the parser
        only evaluates link attributes.
      unused_kb: Unused KnowledgeBase rdf.

    Yields:
      rdf_anomaly.Anomaly if the startup link seems wierd.
      rdf_client.LinuxServiceInformation for each detected service.
    """
    services = {}
    for stat_entry in stats:
      path = stat_entry.pathspec.path
      runlevel = self.runlevel_re.match(os.path.dirname(path))
      runscript = self.runscript_re.match(os.path.basename(path))
      if runlevel and runscript:
        svc = runscript.groupdict()
        service = services.setdefault(
            svc["name"],
            rdf_client.LinuxServiceInformation(
                name=svc["name"], start_mode="INIT"))
        runlvl = GetRunlevelsNonLSB(runlevel.group(1))
        if svc["action"] == "S" and runlvl:
          service.start_on.append(runlvl.pop())
          service.starts = True
        elif runlvl:
          service.stop_on.append(runlvl.pop())
        if not stat.S_ISLNK(int(stat_entry.st_mode)):
          yield rdf_anomaly.Anomaly(
              type="PARSER_ANOMALY",
              finding=[path],
              explanation="Startup script is not a symlink.")
    for svc in itervalues(services):
      yield svc
def ParseMultiple ( self , stats , unused_file_obj , unused_kb ) : services = { } for stat_entry in stats : path = stat_entry . pathspec . path runlevel = self . runlevel_re . match ( os . path . dirname ( path ) ) runscript = self . runscript_re . match ( os . path . basename ( path ) ) if runlevel and runscript : svc = runscript . groupdict ( ) service = services . setdefault ( svc [ "name" ] , rdf_client . LinuxServiceInformation ( name = svc [ "name" ] , start_mode = "INIT" ) ) runlvl = GetRunlevelsNonLSB ( runlevel . group ( 1 ) ) if svc [ "action" ] == "S" and runlvl : service . start_on . append ( runlvl . pop ( ) ) service . starts = True elif runlvl : service . stop_on . append ( runlvl . pop ( ) ) if not stat . S_ISLNK ( int ( stat_entry . st_mode ) ) : yield rdf_anomaly . Anomaly ( type = "PARSER_ANOMALY" , finding = [ path ] , explanation = "Startup script is not a symlink." ) for svc in itervalues ( services ) : yield svc
Identify the init scripts and the start/stop scripts at each runlevel.

    Evaluate all the stat entries collected from the system.
    If the path name matches a runlevel spec, and if the filename matches a
    sysv init symlink process the link as a service.

    Args:
      stats: An iterator of StatEntry rdfs.
      unused_file_obj: An iterator of file contents. Not needed as the parser
        only evaluates link attributes.
      unused_kb: Unused KnowledgeBase rdf.

    Yields:
      rdf_anomaly.Anomaly if the startup link seems wierd.
      rdf_client.LinuxServiceInformation for each detected service.