-
Notifications
You must be signed in to change notification settings - Fork 0
/
egg.py
27 lines (25 loc) · 822 Bytes
/
egg.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
import json
import os
eggs = {}
all = os.listdir("./")
for i in all:
if ".json" in i:
print(i)
with open(f"./{i}", "r")as f:
data = json.load(f)
eggs[data["name"]] = {}
eggs[data["name"]]["egg_id"] = 0
eggs[data["name"]]["max_resource"] = {
"memory": 0,
"disk": 0,
"cpu": 0
},
eggs[data["name"]]["startup"] = data["startup"].replace('"', "'")
for d in data["docker_images"]:
eggs[data["name"]]["docker_image"] = d
eggs[data["name"]]["environment"] = {}
for a in data["variables"]:
eggs[data["name"]]["environment"][a["env_variable"]] = a["default_value"]
print("========複製以下內容========")
print(json.dumps(eggs))
# print(eggs)