from __future__ import print_function
import pandas as pd
import threading, paramiko, os, time
import mysql.connector
import re
import datetime as dt
from dateutil.relativedelta import relativedelta
import json
import subprocess
import sys
from collections import OrderedDict
from json import loads, dumps
xls = pd.ExcelFile("C:\Users\kmuthuk2\Desktop\stable_scripts.xlsx")
sheetX = xls.parse("Sheet1") #2 is the sheet number
print (sheetX.columns)
var1 = sheetX['Script Name']
myresult_cvs = OrderedDict()
for i in range(100,165):
output2=""
print (i,var1[i]) #1 is the row number...
cmd = 'find ./ -name '+var1[i]
connection.send_shell(cmd)
time.sleep(10)
output=""
if connection.shell.recv_ready():
output = connection.shell.recv(50000).decode(encoding='utf-8', errors='ignore')
output=output.strip().replace(cmd,"")
output=PROMPT_REGEX.sub("",output)
output=output.strip().split("\n")
print ("output {}".format(output))
if (len(output)==2):
cmd_cvslog = 'cvs log '+output[1]
test_full_path = output[1]
elif (len(output)==3):
cmd_cvslog = 'cvs log '+output[2]
test_full_path = output[2]
else:
cmd_cvslog = 'cvs log '+output[0]
test_full_path = output[0]
print ("i is {}".format(i))
print ("cmd_cvslog {} ".format(cmd_cvslog))
connection.send_shell(cmd_cvslog)
time.sleep(15)
if connection.shell.recv_ready():
output2 = connection.shell.recv(50000).decode(encoding='utf-8', errors='ignore')
output2=output2.strip().replace(cmd_cvslog,"")
output2=PROMPT_REGEX.sub("",output2)
#output2=output2.strip()
print ("output2 {} ".format(output2))
result=re.findall(CVSLOG_REGEX,output2)
print('this is result')
print(result)
result = result[0]
print('this is result[0]')
print(result)
date_regex = r'date:\s+([^;]+?);'
mydate = re.findall(date_regex,result)
print(mydate)
myresult_cvs[test_full_path]=result
print ("^"*25)
print ("^"*25)
#connection.shell.flush()
print ("myresult_cvs {}".format(myresult_cvs))
print ("myresult_cvs {}".format(loads(dumps(myresult_cvs))))
import pandas as pd
import threading, paramiko, os, time
import mysql.connector
import re
import datetime as dt
from dateutil.relativedelta import relativedelta
import json
import subprocess
import sys
from collections import OrderedDict
from json import loads, dumps
xls = pd.ExcelFile("C:\Users\kmuthuk2\Desktop\stable_scripts.xlsx")
sheetX = xls.parse("Sheet1") #2 is the sheet number
print (sheetX.columns)
var1 = sheetX['Script Name']
myresult_cvs = OrderedDict()
for i in range(100,165):
output2=""
print (i,var1[i]) #1 is the row number...
cmd = 'find ./ -name '+var1[i]
connection.send_shell(cmd)
time.sleep(10)
output=""
if connection.shell.recv_ready():
output = connection.shell.recv(50000).decode(encoding='utf-8', errors='ignore')
output=output.strip().replace(cmd,"")
output=PROMPT_REGEX.sub("",output)
output=output.strip().split("\n")
print ("output {}".format(output))
if (len(output)==2):
cmd_cvslog = 'cvs log '+output[1]
test_full_path = output[1]
elif (len(output)==3):
cmd_cvslog = 'cvs log '+output[2]
test_full_path = output[2]
else:
cmd_cvslog = 'cvs log '+output[0]
test_full_path = output[0]
print ("i is {}".format(i))
print ("cmd_cvslog {} ".format(cmd_cvslog))
connection.send_shell(cmd_cvslog)
time.sleep(15)
if connection.shell.recv_ready():
output2 = connection.shell.recv(50000).decode(encoding='utf-8', errors='ignore')
output2=output2.strip().replace(cmd_cvslog,"")
output2=PROMPT_REGEX.sub("",output2)
#output2=output2.strip()
print ("output2 {} ".format(output2))
result=re.findall(CVSLOG_REGEX,output2)
print('this is result')
print(result)
result = result[0]
print('this is result[0]')
print(result)
date_regex = r'date:\s+([^;]+?);'
mydate = re.findall(date_regex,result)
print(mydate)
myresult_cvs[test_full_path]=result
print ("^"*25)
print ("^"*25)
#connection.shell.flush()
print ("myresult_cvs {}".format(myresult_cvs))
print ("myresult_cvs {}".format(loads(dumps(myresult_cvs))))