feat(cube : create_nicsensor) add init_output_file function
This commit is contained in:
parent
60b1d06650
commit
7997c17932
@ -24,11 +24,24 @@ workspace_path = get_content_before_substring(absolute_path, "src")
|
|||||||
|
|
||||||
board_feature_path = os.path.join(workspace_path, "data", "BoardFeature.json")
|
board_feature_path = os.path.join(workspace_path, "data", "BoardFeature.json")
|
||||||
hw_topo_path = os.path.join(workspace_path, "data", "ServerHwTopo.json")
|
hw_topo_path = os.path.join(workspace_path, "data", "ServerHwTopo.json")
|
||||||
|
output_path = os.path.join(workspace_path, "output", "nicsensor.sh")
|
||||||
|
|
||||||
dbg_print("info", "====== Pre Init ======")
|
dbg_print("info", "====== Pre Init ======")
|
||||||
dbg_print("info", f"workspace_path={workspace_path}")
|
dbg_print("info", f"workspace_path={workspace_path}")
|
||||||
dbg_print("info", f"board_feature_path={board_feature_path}")
|
dbg_print("info", f"board_feature_path={board_feature_path}")
|
||||||
dbg_print("info", f"hw_topo_path={hw_topo_path}")
|
dbg_print("info", f"hw_topo_path={hw_topo_path}")
|
||||||
|
dbg_print("info", f"output_path={output_path}")
|
||||||
|
|
||||||
|
def init_output_file():
|
||||||
|
dbg_print("info", "====== Init output file ======")
|
||||||
|
# if file exist , remove it
|
||||||
|
# create output file
|
||||||
|
try:
|
||||||
|
with open(output_path, 'w', encoding='utf-8') as file:
|
||||||
|
content = "#!/bin/sh"
|
||||||
|
file.write(content)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"写入文件时出现错误: {e}")
|
||||||
|
|
||||||
def process_hw_topo():
|
def process_hw_topo():
|
||||||
dbg_print("info", "====== Process Server Hw Topo ======")
|
dbg_print("info", "====== Process Server Hw Topo ======")
|
||||||
@ -99,4 +112,5 @@ def process_hw_topo():
|
|||||||
# =====================================================
|
# =====================================================
|
||||||
# Start execute script
|
# Start execute script
|
||||||
# =====================================================
|
# =====================================================
|
||||||
|
init_output_file()
|
||||||
process_hw_topo()
|
process_hw_topo()
|
||||||
Loading…
Reference in New Issue
Block a user