Ejemplo n.º 1
0
def execute():
    logger.info("The following set of commands is available for execution: %s" % ",".join([s for s,c in CONF.COMMANDS]))
    logger.info("The following set of commands will be executed: %s" % ",".join(commandsToRun))
    
    if ( "CLEANUP_WWW_AREA" in commandsToRun ) :
      logger.info("Cleaning up logs area...")
      CONF.cleanupLogs()
    for section,cmds in CONF.COMMANDS:
      if section in commandsToRun :
        logger.info("----++++ %s ++++----" % section)
        for cmd in cmds:
            system(cmd,log=True, exception=False)
Ejemplo n.º 2
0
def execute():
    logger.info(
        "The following set of commands is available for execution: %s" %
        ",".join([s for s, c in CONF.COMMANDS]))
    logger.info("The following set of commands will be executed: %s" %
                ",".join(commandsToRun))

    if ("CLEANUP_WWW_AREA" in commandsToRun):
        logger.info("Cleaning up logs area...")
        CONF.cleanupLogs()
    for section, cmds in CONF.COMMANDS:
        if section in commandsToRun:
            logger.info("----++++ %s ++++----" % section)
            for cmd in cmds:
                system(cmd, log=True, exception=False)
Ejemplo n.º 3
0
def cleanupLogs() :
  # The following lines are meant to delete old platform directories containing RPMs and logs
  target_platform = "unknown"
  if pseudo_platform == "slc5_i686":
      target_platform = "i686-with-redhat-5"
  elif pseudo_platform == "slc5_x86_64":
      target_platform = "x86_64-with-redhat-5"
  elif pseudo_platform == "slc6_x86_64":
      target_platform = "x86_64-with-redhat-6"
  system("mkdir -p %s" % NIGHTLY_BASE,exception=False)
  system("rm -f %s" % join(NIGHTLY_BASE,"..",pseudo_platform),exception=False)
  system("ln -s %s %s" % (NIGHTLY_BASE,join(NIGHTLY_BASE,"..",pseudo_platform)),exception=False)

  del_dirs = [d for d in listdir(join(NIGHTLY_BASE, "..")) if isdir(join(NIGHTLY_BASE, "..", d)) and d.find(target_platform) != -1 and d != platform()]
  for d in del_dirs:
      system("rm -rf %s" % join(NIGHTLY_BASE, "..", d), exception=False)
Ejemplo n.º 4
0
def cleanupLogs() :
  # The following lines are meant to delete old platform directories containing RPMs and logs
  target_platform = "unknown"
  if pseudo_platform == "slc5_i686":
      target_platform = "i686-with-redhat-5"
  elif pseudo_platform == "slc5_x86_64":
      target_platform = "x86_64-with-redhat-5"
  elif pseudo_platform == "slc6_x86_64":
      target_platform = "x86_64-with-redhat-6"
    
    
  system("mkdir -p %s" % NIGHTLY_BASE,exception=False)
  system("rm -f %s" % join(NIGHTLY_BASE,"..",pseudo_platform),exception=False)
  system("ln -s %s %s" % (NIGHTLY_BASE,join(NIGHTLY_BASE,"..",pseudo_platform)),exception=False)

  del_dirs = [d for d in listdir(join(NIGHTLY_BASE, "..")) if isdir(join(NIGHTLY_BASE, "..", d)) and d.find(target_platform) != -1 and d != platform()]
  for d in del_dirs:
      system("rm -rf %s" % join(NIGHTLY_BASE, "..", d), exception=False)
Ejemplo n.º 5
0
    # Check if command list given is valid
    for command in commandsToRun:
      if command in [s for s,c in CONF.COMMANDS] :
        continue
      else:
        sys.stderr.write( "ERROR: Command '" + command + "' is not available.\n" )
        sys.stderr.write( "List of available commands : %s\n" % str([s for s,c in CONF.COMMANDS]) )
        sys.exit(2)
    
    if not silent :
      logger.info("Reports will be sent to: %s" % CONF.TO_EMAIL )
    
    # Execute build/test/etc.
    try:
        execute()
    except KeyboardInterrupt,e:
        logger.warning('Aborting after CTRL-C...\n')
        sys.exit(1)
    except Exception,e:
        logger.error(e)


    if silent:
        logger.info("Final reporting and email notifications were disabled")
    else:
        logger.info("----++++REPORTING++++----")
        nanalyzer.report(CONF)
        system("mkdir -p %s" % CONF.NIGHTLY_LOG_DIR,log=True, exception=False)
        system( "sudo cp -r %s %s" % ("/var/log/*",CONF.NIGHTLY_LOG_DIR),log=True, exception=False)
Ejemplo n.º 6
0
        if command in [s for s, c in CONF.COMMANDS]:
            continue
        else:
            sys.stderr.write("ERROR: Command '" + command +
                             "' is not available.\n")
            sys.stderr.write("List of available commands : %s\n" %
                             str([s for s, c in CONF.COMMANDS]))
            sys.exit(2)

    if not silent:
        logger.info("Reports will be sent to: %s" % CONF.TO_EMAIL)

    # Execute build/test/etc.
    try:
        execute()
    except KeyboardInterrupt, e:
        logger.warning('Aborting after CTRL-C...\n')
        sys.exit(1)
    except Exception, e:
        logger.error(e)

    if silent:
        logger.info("Final reporting and email notifications were disabled")
    else:
        logger.info("----++++REPORTING++++----")
        nanalyzer.report(CONF)
        system("mkdir -p %s" % CONF.NIGHTLY_LOG_DIR, log=True, exception=False)
        system("sudo cp -r %s %s" % ("/var/log/*", CONF.NIGHTLY_LOG_DIR),
               log=True,
               exception=False)