diff --git a/cube/src/create_nicsensor.py b/cube/src/create_nicsensor.py index 1e6a05b..67566ce 100644 --- a/cube/src/create_nicsensor.py +++ b/cube/src/create_nicsensor.py @@ -24,11 +24,24 @@ workspace_path = get_content_before_substring(absolute_path, "src") board_feature_path = os.path.join(workspace_path, "data", "BoardFeature.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", f"workspace_path={workspace_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"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(): dbg_print("info", "====== Process Server Hw Topo ======") @@ -99,4 +112,5 @@ def process_hw_topo(): # ===================================================== # Start execute script # ===================================================== +init_output_file() process_hw_topo() \ No newline at end of file