-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlastConfigChange.py
More file actions
59 lines (49 loc) · 1.87 KB
/
lastConfigChange.py
File metadata and controls
59 lines (49 loc) · 1.87 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
'''
Created on May 5, 2017
@author: sp977u
'''
class prevConfchange :
def configChangeDateTimeInfo(self,logpath, ipadd):
Final = "NF"
serialList = []
rowswritten = 0
juniScan = "N"
try :
sucFile = open(logpath + "\\" + ipadd + ".txt" , 'r')
while 1:
line = sucFile.readline()
if "Last configuration change" in line :
line= line.replace("! Last configuration change at", ' ')
loc = line.find('by')
Final = line[ :loc ]
Final = Final.strip()
break
if "Configuration last modified" in line and "by" in line and "at" in line:
loc = line.find('at ')
line = line [ loc+2:]
Final = line.strip()
break
if "Configuration has not been" in line:
Final = "No change since last system restart"
break
if "No configuration change since" in line:
Final = "No change since last system restart"
break
if "Last commit" in line:
line = line.replace("## Last commit:", ' ')
loc = line.find('by')
line = line [ : loc -1 ]
Final = line.strip()
break
if not line:
break
if line =="\n":
continue
sucFile.close()
#print( partNoList)
return Final
except Exception as ex:
print(ex)
sucFile.close()
return "NF"
#===