-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimageInfo.py
More file actions
59 lines (43 loc) · 1.7 KB
/
imageInfo.py
File metadata and controls
59 lines (43 loc) · 1.7 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 Apr 29, 2017
@author: sp977u
'''
class imageInformation :
def getImageInfo(self,logpath, ipadd):
matchfound = "F"
Final = "NF"
try :
sucFile = open(logpath + "\\" + ipadd + ".txt" , 'r')
while 1:
line = sucFile.readline()
if "System image file" in line :
loc = line.find(':')
Final = line[loc +1 : ]
Final = Final.replace('"'," ")
loc = Final.find("/")
Final = Final[loc +1: ]
Final = Final.strip()
matchfound = "T"
break
if "Base OS Software Suite" in line:
loc = line.find('[')
line = line[loc +1 :]
Final = line.replace(']', " ").strip()
matchfound = "T"
break
if "JUNOS EX Software Suite" in line:
loc = line.find('[')
line = line[loc +1 :]
Final = line.replace(']', " ").strip()
matchfound = "T"
break
if not line:
break
if line =="\n":
continue
sucFile.close()
return Final
except Exception as ex:
print(ex)
sucFile.close()
return "NF"