Пример #1
0
    print "The local_name should be a name in the %VIGDIR%\\Tests\\smoke\\valid_db"
    print "directory.  This is the file used in the diff."
    sys.exit(0)


# Append suffix if not present
if string.find(log_name, ".log") == -1 :
    log_name = log_name + ".log"
    
TEMP = os.environ['TEMP']
local_log = open(TEMP + "\\vigilert\\roc\\" + log_name, "wb+")
print "Retrieving new log file"

# Callback write function for the edification of ftp.retrbinary, see below
def log_writer(line) :
    global local_log
    local_log.write(line)

# Retrieve the log file from roc
ftp = FTP('90.0.0.15')
ftp.login('informix', 'informix')
ftp.cwd('/opt/informix/extend/Vigilert')
ftp.retrbinary('RETR vigilert.log', log_writer, 8192)
local_log.close()
ftp.quit()

print "Diffing"
diff_name = string.replace(log_name, ".log", "_diff.txt")
diff(vigdir+"\\tests\\smoke\\valid_db\\" + log_name, TEMP + "\\vigilert\\roc\\" + log_name,\
     TEMP+"\\vigilert\\roc\\" + diff_name)
Пример #2
0
log_path = os.path.normpath(log_path)
log_name = os.path.basename(log_path)
   
TEMP = os.environ['TEMP']
try:
    os.mkdir(TEMP +"\\Vigilert\\roc")
except:
    pass

local_log = open(TEMP + "\\vigilert\\roc\\" + log_name, "wb+")
print "Retrieving new log file"

# Callback write function for the edification of ftp.retrbinary, see below
def log_writer(line) :
    global local_log
    local_log.write(line)

# Retrieve the log file from roc
import socket
ftp = FTP(socket.gethostbyname("roc"))
ftp.login('informix', 'informix')
ftp.cwd('/opt/informix/extend/Vigilert')
ftp.retrbinary('RETR vigilert.log', log_writer, 8192)
local_log.close()
ftp.quit()

print "Diffing"
diff_name = string.replace(log_name, ".log", "_diff.txt")
diff(log_path, TEMP + "\\vigilert\\roc\\" + log_name, TEMP+"\\vigilert\\roc\\" + diff_name)