-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptionInfo.py
More file actions
61 lines (49 loc) · 2.2 KB
/
exceptionInfo.py
File metadata and controls
61 lines (49 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
'''
Created on 8 NOV 2017
@author: sp977u ( Satish Palnati )
'''
class exceptionDetails :
def doIhaveExceptioinInfo(self,logpath, ipadd):
self.Final = "NF"
self.serialList = []
self.rowswritten = 0
self.juniScan = "N"
self.exceptionInfo = " "
self.logpath = logpath
self.ipadd = ipadd
self.tempBanner = "NF"
try :
self.sucFile = open(logpath + "\\" + ipadd + ".txt" , 'r')
while 1:
self.line = self.sucFile.readline()
if "show" in self.line or "sho" in self.line :
continue
if "banner " in self.line :
self.tempBanner = (self.line [ : ]).lower()
if "EXCEPTION" in self.tempBanner or "exception" in self.tempBanner :
self.Final = "Yes"
loc1 = self.tempBanner.find("exception")
self.exceptionInfo = (self.line[loc1:]).replace("*** ^",'')
self.exceptionInfo = self.exceptionInfo.replace("*** ^C",'')
self.exceptionInfo = self.exceptionInfo.replace('\n','')
break
if "announcement" in self.line :
self.tempBanner = (self.line [ : ]).lower()
if "exception" in self.tempBanner :
self.Final = "Yes"
loc1 = self.tempBanner.find("exception")
self.exceptionInfo = (self.line[loc1:]).replace("***",'')
self.exceptionInfo = self.exceptionInfo.replace("\n", '')
break
if not self.line:
break
if self.line =="\n":
continue
self.sucFile.close()
#print( partNoList)
return self.Final,self.exceptionInfo
except Exception as ex:
print(ex)
self.sucFile.close()
return "Fail",self.exceptionInfo
#===