Skip to content

Commit 7fa8888

Browse files
committed
modify upload py
1 parent b682e54 commit 7fa8888

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import os
22
import json
3-
3+
4+
45
def get_files():
56
recordList = []
6-
for filepath,dirnames,filenames in os.walk(r'./quickstarts'):
7+
for filepath, dirnames, filenames in os.walk(r'./quickstarts'):
78
for filename in filenames:
89
if filename != 'TestRecord.md':
910
continue
@@ -16,33 +17,35 @@ def get_files():
1617
version = ""
1718
# print(testRecordPath)
1819

19-
f = open(os.path.join(filepath,filename))
20-
line = f.readline()
21-
while line:
22-
if line.startswith("## "):
20+
f = open(os.path.join(filepath, filename))
21+
line = f.readline()
22+
while line:
23+
if line.startswith("## ") and updateTime == "":
2324
updateTime = line.strip("## ").strip("\n")
24-
if line.startswith("success"):
25+
if line.startswith("success") and success == "":
2526
success = line.strip("success: ").strip("\n")
26-
if line.__contains__("+ provider") and line.__contains__("alicloud"):
27-
version = line.strip("+ provider ").split(" ")[-1].strip("\n")
27+
if line.__contains__("+ provider") and line.__contains__("alicloud") and version == "":
28+
version = line.strip(
29+
"+ provider ").split(" ")[-1].strip("\n")
2830
break
29-
line = f.readline()
30-
31+
line = f.readline()
32+
3133
f.close()
3234
error = ""
33-
logPath = os.path.join(filepath,'terraform.log')
35+
logPath = os.path.join(filepath, 'terraform.log')
3436
if success == "false" and os.path.exists(logPath):
3537
f = open(logPath)
3638
error = f.read()
3739
f.close()
38-
39-
d = dict(subcategory=subcategory,exampleName=exampleName,updateTime=updateTime,version=version,success=success,error=error)
40+
41+
d = dict(subcategory=subcategory, exampleName=exampleName,
42+
updateTime=updateTime, version=version, success=success, error=error)
4043
recordList.append(d)
41-
44+
4245
finalRecord = dict(data=recordList)
43-
with open("./TestRecord.json","w") as file:
44-
json.dump(finalRecord,file)
46+
with open("./TestRecord.json", "w") as file:
47+
json.dump(finalRecord, file)
4548

4649

4750
if __name__ == '__main__':
48-
get_files()
51+
get_files()

0 commit comments

Comments
 (0)