def getEmailsToNotifyAboutParsingFailures():
    userName = multiUserSupport.getServerUser()
    addr = ["*****@*****.**", "*****@*****.**"]
    #  addr = ["*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**"]
    # one of us?
    if "infoman-kjk"== userName:
        addr = ["*****@*****.**"]
#    if "infoman-szymon"== userName:
#        addr = ["[email protected], [email protected], [email protected]"]
#    if "infoman-andrzej"== userName:
#        addr = ["*****@*****.**"]
    return addr
示例#2
0
def mailException(txt):
    global g_allExcTxt, g_lastExceptionMailTime, g_mailExceptionLock
    g_mailExceptionLock.acquire()
    try:
        mailingFrequency = g_hourInSeconds
        g_allExcTxt += txt
        curTime = time.time()
        # disable buffering of exceptions
        # now I think it's better to just send them immediately
        #if (None == g_lastExceptionMailTime) or (curTime > g_lastExceptionMailTime + mailingFrequency):
        if True:
            # send the e-mail about exception if at least 60 min passed
            # since the last e-mail
            g_lastExceptionMailTime = curTime
            curDate = time.strftime( "%Y-%m-%d", time.localtime() )
            subject = "InfoMan server exception on %s" % curDate
            emailContent = "Server: %s on port %d\n" % (multiUserSupport.getServerUser(), multiUserSupport.getServerPort())
            emailContent += g_allExcTxt
            g_allExcTxt = ""
            parserErrorLogger.mail(subject, emailContent)
    finally:
        g_mailExceptionLock.release()
示例#3
0
def mailException(txt):
    global g_allExcTxt, g_lastExceptionMailTime, g_mailExceptionLock
    g_mailExceptionLock.acquire()
    try:
        mailingFrequency = g_hourInSeconds
        g_allExcTxt += txt
        curTime = time.time()
        # disable buffering of exceptions
        # now I think it's better to just send them immediately
        #if (None == g_lastExceptionMailTime) or (curTime > g_lastExceptionMailTime + mailingFrequency):
        if True:
            # send the e-mail about exception if at least 60 min passed
            # since the last e-mail
            g_lastExceptionMailTime = curTime
            curDate = time.strftime("%Y-%m-%d", time.localtime())
            subject = "InfoMan server exception on %s" % curDate
            emailContent = "Server: %s on port %d\n" % (
                multiUserSupport.getServerUser(),
                multiUserSupport.getServerPort())
            emailContent += g_allExcTxt
            g_allExcTxt = ""
            parserErrorLogger.mail(subject, emailContent)
    finally:
        g_mailExceptionLock.release()
示例#4
0
# Copyright: Krzysztof Kowalczyk
# Owner: Krzysztof Kowalczyk
#
# Purpose:
#   Import data from *.csv file with reg codes generated by infoman_gen_reg_codes.py
#   into a database so that the server can properly authenticate users.

import sys, os, MySQLdb, _mysql_exceptions
import infoman_gen_reg_codes
import multiUserSupport

g_conn = MySQLdb.Connect(host='localhost',
                         user=multiUserSupport.getServerUser(),
                         passwd='infoman',
                         db=multiUserSupport.getServerDatabaseName())
g_cur = g_conn.cursor()


def dbEscape(txt):
    # it's silly that we need connection just for escaping strings
    global g_conn
    return g_conn.escape_string(txt)


def sql_qq(txt):
    return dbEscape(txt)


def getOneResult(conn, query):
    cur = conn.cursor()
    cur.execute(query)
示例#5
0
import os, sys, string, re, socket, random, time, smtplib
import arsutils, multiUserSupport
import Fields
from InfoManServer import *

SERVER_PORT = multiUserSupport.getServerPort()
SERVER_USER = multiUserSupport.getServerUser()

PYTHON_EXEC = "python2.4"

# possible server states
# we can find the server process and it responds to our ping request
STATE_ALIVE = 0
# we can find the server process but it doesn't respond to our poing request
# (too busy?)
STATE_NOT_RESPONDING = 1
# we can't find the server process
STATE_DEAD = 2

def stateName(state):
    if STATE_ALIVE == state:
        return "STATE_ALIVE"

    if STATE_NOT_RESPONDING == state:
        return "STATE_NOT_RESPONDING"

    if STATE_DEAD == state:
        return "STATE_DEAD"

    return "UNKNOWN"
import os, sys, string, re, socket, random, time, smtplib
import arsutils, multiUserSupport
import Fields
from InfoManServer import *

SERVER_PORT = multiUserSupport.getServerPort()
SERVER_USER = multiUserSupport.getServerUser()

PYTHON_EXEC = "python2.4"

# possible server states
# we can find the server process and it responds to our ping request
STATE_ALIVE = 0
# we can find the server process but it doesn't respond to our poing request
# (too busy?)
STATE_NOT_RESPONDING = 1
# we can't find the server process
STATE_DEAD = 2


def stateName(state):
    if STATE_ALIVE == state:
        return "STATE_ALIVE"

    if STATE_NOT_RESPONDING == state:
        return "STATE_NOT_RESPONDING"

    if STATE_DEAD == state:
        return "STATE_DEAD"

    return "UNKNOWN"
示例#7
0
# Copyright: Krzysztof Kowalczyk
# Owner: Krzysztof Kowalczyk
#
# Purpose:
#   Import data from *.csv file with reg codes generated by infoman_gen_reg_codes.py
#   into a database so that the server can properly authenticate users.

import sys,os,MySQLdb,_mysql_exceptions
import infoman_gen_reg_codes
import multiUserSupport

g_conn = MySQLdb.Connect(host='localhost', user = multiUserSupport.getServerUser(), passwd='infoman', db = multiUserSupport.getServerDatabaseName())
g_cur = g_conn.cursor()

def dbEscape(txt):
    # it's silly that we need connection just for escaping strings
    global g_conn
    return g_conn.escape_string(txt)

def sql_qq(txt):
    return dbEscape(txt)

def getOneResult(conn,query):
    cur = conn.cursor()
    cur.execute(query)
    row = cur.fetchone()
    res = row[0]
    cur.close()
    return res

def fCodeExists(reg_code):
def mailRetrieveFailure(fieldName, fieldValue, url):
    global MAILHOST
    if None == fieldValue:
        fieldValue = ""
    curDate = time.strftime( "%Y-%m-%d", time.localtime() )
    userName = multiUserSupport.getServerUser()
    subject = "InfoMan retrieve failure notification %s for %s" % (curDate, userName)
    emailContent = "Server: %s on port %d\n" % (multiUserSupport.getServerUser(), multiUserSupport.getServerPort())
    txt = "InfoMan failed to retrieve results for query:\n%s: %s\n" % (fieldName, fieldValue)
    if None != url:
        txt = "%surl=%s\n" % (txt, url)
    mail(subject, txt)