-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVALIDATE.py
38 lines (35 loc) · 981 Bytes
/
VALIDATE.py
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
import MDM
import MOD
import sys
def isfile(filename):
try :
f = open(filename, "r")
f.close();
return 1
except Exception, e:
print 'now log exec'
return -1
def fileVAL(filename):
try:
print "Now will do file validation and replcace old file"
b = MOD.watchdogReset()
f = open(filename, "r")
datatosave=f.read();
f.close()
fileList = datatosave.split(':')
noOfFile = len(fileList)
counter = 0
while counter < noOfFile :
print fileList[counter]
# here split file name and its checksum.
filenamehas = fileList[counter].split(',')
print filenamehas[0]
filename = 'new_'+filenamehas[0]
ret = isfile(filename)
counter = counter + 1
if(ret == -1):
return -1
rename(filename,filenamehas[0])
return 1
except Exception, e:
return -1