ajack       2004/05/12 12:36:04

  Modified:    .        gumpy.py
  Log:
  Display log (if tty, even if not an error)
  
  Revision  Changes    Path
  1.34      +19 -23    gump/gumpy.py
  
  Index: gumpy.py
  ===================================================================
  RCS file: /home/cvs/gump/gumpy.py,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- gumpy.py  12 May 2004 18:00:52 -0000      1.33
  +++ gumpy.py  12 May 2004 19:36:03 -0000      1.34
  @@ -403,27 +403,25 @@
       

       releaseLock(lock,lockFile)

       

  +    logTitle='Apache Gump Logfile'

       if result:

           logTitle='Problem running Apache Gump...'

           

  -        # :TODO: Need to check if stdout is a plain terminal? Not sure, see next.

  -        # :TODO: On some cron set-ups this will mail the log, on

  -        # others it won't.

  -        #

  -        # Cat log if failed...

  -        published=0

  -        if logdir:

  -            publishedLogFile=os.path.abspath(os.path.join(logdir,logFileName))

  -            try:

  -                publishedLog=open(publishedLogFile,'w',0) # Unbuffered...

  -                catFile(publishedLog, logFile, logTitle)    

  -                publishedLog.close()

  -                published=1

  -            except:

  -                published=0

  -        else:

  -            print 'Unable to publish log file (containing failures)'

  -              

  +    # Publish logfile

  +    published=0

  +    if logdir:

  +        publishedLogFile=os.path.abspath(os.path.join(logdir,logFileName))

  +        try:

  +            publishedLog=open(publishedLogFile,'w',0) # Unbuffered...

  +            catFile(publishedLog, logFile, logTitle)    

  +            publishedLog.close()

  +            published=1

  +        except:

  +            published=0

  +    else:

  +        print 'Unable to publish log file.'

  +         

  +    if result:     

           # Cat to screen (if running to screen)

           tty=0

           try:

  @@ -441,9 +439,6 @@
                   mailData='There is a problem with the run at : ' + hostname + ':' + 
workspaceName + '\n'

               

               #

  -            # :TODO: Add link to log 

  -            # :TODO: Tail log

  -            #

               try:

                   maxTailLines=50

                   tailData=tailFileToString(logFile,maxTailLines)           

  @@ -451,7 +446,8 @@
                   mailData += 'The log ought be at:\n'

                   mailData += '   '

                   logFileUrl=logurl

  -                if not logFileUrl.endswith('/'): logFileUrl+='/'

  +                if not logFileUrl.endswith('/'): 

  +                    logFileUrl+='/'

                   logFileUrl+=logFileName

                   mailData += logFileUrl

                   mailData += '\n'

  @@ -470,7 +466,7 @@
               sendEmail(mailto,mailfrom,logTitle,mailData,mailserver,mailport)

               

           else:

  -            print 'Unable to mail report of failure : ' + 
`[mailserver,mailport,mailto,mailfrom]`

  +            print 'Unable to mail failure report : ' + 
`[mailserver,mailport,mailto,mailfrom]`

   

   # bye!

   sys.exit(result)

  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to