예제 #1
0
def run_survey(cnx, sources):
    """
    runs the survey on a list of sources

    :param sources: list of SourceInfo instances
    """
    rpt = Report(cnx)
     
    for f in filter_list:
        for src in sources:
            survey_path = f.run_survey(src.source_name)
            if survey_path is not None:
                curr_report_dir = os.path.join("reports", src.source_name, "filters", f.name)
                try:
                    shutil.rmtree(curr_report_dir)
                except:
                    pass

                shutil.move(survey_path, curr_report_dir)
                rpt.generate_report(src)
예제 #2
0
파일: modes.py 프로젝트: cglewis/Redwood
 def do_run_report_survey(self, source = None):
     '''[*] run_survey (optional)<source_name>\n\t|- runs the survey function for the given source\n\t |- if no source is provided run_survey processes all sources\n\t|-[source_name] - option name of source to process'''
     rpt = Report(self.cnx)
     if source == None:
         sources = core.get_all_sources(self.cnx)
         for s in sources:
             print "Running report survey for: " + s.source_name
             rpt.run_filter_survey(s.source_name)
             rpt.generate_report(s)
     else:
         src = core.get_source_info(self.cnx, source)
         if src == None:
             print "Source " + source + " does not exist"
             return
         print "Running report survey for: " + src.source_name
         rpt.run_filter_survey(src.source_name)
         rpt.generate_report(src)
예제 #3
0
    def do_run_survey(self, line):
        '''
        run_survey <source_name>
            
        runs the survey function for the given source
        
        [source_name] - option name of source to process
        '''

	args = shlex.split(line)
	
	if len(args) < 1:
            print "Error: Incorrect # of arguments"
	    return

        src_obj = core.get_source_info(self.cnx, args[0])
        
        if src_obj is None:
            print "Error: Unable to find source {}".format(args[0])
            return
        else:
            rpt = Report(self.cnx, src_obj)
	    if len(args) > 1:
        	rpt.run(args[1:])
	    else:
		rpt.run(None)