diff --git a/component/DevKitWeb/build_devkit_installer.sh b/component/DevKitWeb/build_devkit_installer.sh new file mode 100644 index 0000000000000000000000000000000000000000..be01ab97601ae999db85beccbc38fd5e3808101a --- /dev/null +++ b/component/DevKitWeb/build_devkit_installer.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# SourceCode build script +# Copyright: Copyright (c) Huawei Technologies Co., Ltd. All rights reserved. + +set -e +current_dir=$(cd $(dirname "$0"); pwd) +project_dir=$(dirname $(dirname "${current_dir}")) + +umask 077 + +build_dir=${project_dir}/build/devkit_installer +rm -rf "${build_dir}" +mkdir -p "${build_dir}" + +cd "${build_dir}" + +pyinstaller -F "${current_dir}"/devkit_installer/devkit_installer.py -p "${current_dir}"/devkit_installer --name "devkit_installer" + +mkdir -p "${project_dir}"/build/component/DevKitWeb +cp "${build_dir}"/dist/devkit_installer "${project_dir}"/build/component/DevKitWeb diff --git a/component/DevKitWeb/devkit_installer/devkit_machine.py b/component/DevKitWeb/devkit_installer/devkit_machine.py index 0ff751dc6b02ec7a40f4f6088b4ca282a1a685ae..c8000deffc6a7a378d8b0c2f5d0a5c821d6b952c 100644 --- a/component/DevKitWeb/devkit_installer/devkit_machine.py +++ b/component/DevKitWeb/devkit_installer/devkit_machine.py @@ -82,7 +82,7 @@ class DevKitMachine: LOGGER.error(f"DevKit install package not exists: {package_file}") return False - cmd = f"cd {package_dir} && tar -zxf {package_name}" + cmd = f"cd {package_dir} && sudo tar -zxf {package_name}" stdin, stdout, stderr = ssh_client.exec_command(cmd) exit_status = stdout.channel.recv_exit_status() if exit_status == 0: @@ -110,7 +110,7 @@ class DevKitMachine: else: plugin_param = f"--plugin={plugin}" - cmd = (f"cd {self.install_dir} && yes | head -1 | ./{self.install_file} {plugin_param} -d={install_path} " + cmd = (f"cd {self.install_dir} && yes | head -1 | sudo bash {self.install_file} {plugin_param} -d={install_path} " f"--ip={server_ip} --map_ip={server_ip} -p={server_port} --http_port={http_port} " f"--rpc_ip={server_ip} --rpc_port={rpc_port} --normal-install=1") LOGGER.info(f"cmd: {cmd}") diff --git a/component/DevKitWeb/devkit_installer/installer_command_line.py b/component/DevKitWeb/devkit_installer/installer_command_line.py index 9ea38bc51cb2e13cfdd2b67a16258da874fd891b..0c73f93d3d9784dd8e7bf74d1c4d5fb52ff54bff 100644 --- a/component/DevKitWeb/devkit_installer/installer_command_line.py +++ b/component/DevKitWeb/devkit_installer/installer_command_line.py @@ -1,6 +1,6 @@ import argparse -PACKAGE_NAME = "DevKit-All-24.0.RC1-Linux-Kunpeng.tar.gz" +PACKAGE_NAME = "DevKit-All-23.0.T30-Linux-Kunpeng.tar.gz" class CommandLine: diff --git a/component/build_component.sh b/component/build_component.sh index ddb166c067dd942d443293e40392d980cee9e31d..2be9d3364818ddcdc1a7f77b4546191db7c19fa5 100644 --- a/component/build_component.sh +++ b/component/build_component.sh @@ -22,6 +22,10 @@ function build_devkit_distribute() { bash "${current_dir}"/DevkitDistribute/build_devkit_distribute.sh } +function build_devkit_installer() { + bash "${current_dir}"/DevKitWeb/build_devkit_installer.sh +} + function main() { if [[ -d ${final_component_dir} ]]; then rm -rf "${final_component_dir}" @@ -38,6 +42,7 @@ function main() { build_lkp_tests build_devkit_distribute + build_devkit_installer } main "$@" diff --git a/tools/install_dependency/src/constant.py b/tools/install_dependency/src/constant.py index 46a2883a1bbb8a3aafebb5a21d99605bb588e0f0..f403763152bb2c8d922aff746d7a8425e815d9e0 100644 --- a/tools/install_dependency/src/constant.py +++ b/tools/install_dependency/src/constant.py @@ -16,10 +16,11 @@ ROLE_COMPONENT = { SCANNER: ["BiShengJDK17"], C_BUIDLER: ["GCCforOpenEuler", "BiShengCompiler", "BiShengJDK17", "A-FOT", "NonInvasiveSwitching"], JAVA_BUILDER: ["BiShengJDK17", "BiShengJDK8"], - EXECUTOR: ["BiShengJDK17", "LkpTests"] + EXECUTOR: ["BiShengJDK17", "LkpTests"], + DEVKIT: ["DevKitWeb"] } -ROLE_LIST = [SCANNER, C_BUIDLER, JAVA_BUILDER, EXECUTOR] +ROLE_LIST = [SCANNER, C_BUIDLER, JAVA_BUILDER, EXECUTOR, DEVKIT] FILE = "file" SHA256 = "sha256" diff --git a/tools/install_dependency/src/download/download_config.py b/tools/install_dependency/src/download/download_config.py index 1bc885d55143a5972b62996cd72f89ccea91e371..bd7b2a8113c9aa60c40a02393bc624236a3769f0 100644 --- a/tools/install_dependency/src/download/download_config.py +++ b/tools/install_dependency/src/download/download_config.py @@ -31,6 +31,11 @@ CompatibilityTesting = { "file": "https://gitee.com/openeuler/devkit-pipeline/releases/download/v0.2/compatibility_testing.tar.gz", } +DevKitWeb = { + "component_name": "DevKitWeb", + "file": "https://kunpeng-repo.obs.cn-north-4.myhuaweicloud.com/Porting%20Advisor/Porting%20Advisor%2023.0.T30/DevKit-All-23.0.T30-Linux-Kunpeng.tar.gz", + "sha256": "https://kunpeng-repo.obs.cn-north-4.myhuaweicloud.com/Porting%20Advisor/Porting%20Advisor%2023.0.T30/DevKit-All-23.0.T30-Linux-Kunpeng.tar.gz.asc", +} OpenEuler_2003_LTS = { "component_name": "openEuler_2003_LTS", diff --git a/tools/install_dependency/src/download/download_utils.py b/tools/install_dependency/src/download/download_utils.py index d9960e71be3e413f7950524641fb596b3c19eee8..4a310d403ca2569ed43b102dd1359ebd9c4a115a 100644 --- a/tools/install_dependency/src/download/download_utils.py +++ b/tools/install_dependency/src/download/download_utils.py @@ -42,6 +42,7 @@ component_collection_map = { download_config.GCCforOpenEuler, download_config.BiShengJDK8, download_config.BiShengJDK17, + download_config.DevKitWeb, ) } diff --git a/tools/install_dependency/src/handler/connect_check.py b/tools/install_dependency/src/handler/connect_check.py index 02cf7c5cbeb979ae4b879a678b909fde0e78c9f5..33927714b8b58acf7d68d8571ee1c5e3dc005e6b 100644 --- a/tools/install_dependency/src/handler/connect_check.py +++ b/tools/install_dependency/src/handler/connect_check.py @@ -3,7 +3,6 @@ import socket import constant from handler.handler_and_node import Handler -from machine.local_machine import LocalMachine from machine.machine import Machine from exception.connect_exception import ConnectException from constant import ROLE_COMPONENT, ROLE_LIST @@ -14,23 +13,16 @@ LOGGER = logging.getLogger("install_dependency") class ConnectCheck(Handler): def handle(self, data) -> bool: LOGGER.debug("ConnectCheck start!") - local_ip = ConnectCheck.get_local_ip() data[constant.MACHINE] = dict() ret = True for role in (ROLE_LIST & data.keys()): - ret = ret and ConnectCheck.machine_role_check(data, role, local_ip) + ret = ret and ConnectCheck.machine_role_check(data, role) return ret @staticmethod - def machine_role_check(data, role, local_ip): + def machine_role_check(data, role): builder_list = data.get(role) for ip in builder_list: - if ip == local_ip or ip == "127.0.0.1": - ip = "127.0.0.1" - machine_instance = data[constant.MACHINE].get(ip, LocalMachine(ip)) - machine_instance.add_component(ROLE_COMPONENT[role]) - data[constant.MACHINE][ip] = machine_instance - continue try: machine_instance = data[constant.MACHINE].get(ip, Machine(ip, data[constant.USER], data[constant.PKEY], data.get(constant.PASSWORD, None))) diff --git a/tools/install_dependency/src/machine/local_machine.py b/tools/install_dependency/src/machine/local_machine.py deleted file mode 100644 index fece548dcbc876a382f1648a4a06e38194eef254..0000000000000000000000000000000000000000 --- a/tools/install_dependency/src/machine/local_machine.py +++ /dev/null @@ -1,303 +0,0 @@ -import os -import logging -import subprocess - -import constant -from deploy.command_line import CommandLine -from exception.connect_exception import NotMatchedMachineTypeException -from download.download_utils import component_collection_map -from deploy.lkp_collect_map import lkp_collection_map -from utils import (base_path, MKDIR_TMP_DEVKITDEPENDENCIES_CMD, YUM_INSTALL_LKP_DEPENDENCIES_CMD, - CHECK_MIRROR_INSTALL_STATUS, PROMPT_MAP) - -LOGGER = logging.getLogger("install_dependency") -SHELL_FILE_LIST = ["install.sh", "check_install_result.sh"] - - -class LocalMachine: - def __init__(self, ip): - self.ip = ip - self.check_is_aarch64() - self.component_list = [] - self.mirrors = False - - def set_mirror(self): - self.mirrors = True - - def add_component(self, component): - self.component_list.extend(component) - self.component_list = list(set(self.component_list)) - - def get_components(self): - return self.component_list.copy() - - def install_components(self): - if self.mirrors: - self.install_component("OpenEulerMirrorISO") - for component in self.component_list: - self.install_component(component) - if self.mirrors: - self.install_component("UnOpenEulerMirrorISO") - - self.clear_tmp_file_at_local_machine([os.path.join("/tmp/", constant.DEPENDENCY_DIR)]) - - def check_is_aarch64(self): - machine_type = os.uname().machine.lower() - LOGGER.info(f"{self.ip} machine type: {machine_type}") - if machine_type != "aarch64": - LOGGER.error(f"Machine type of {self.ip} is {machine_type}, not aarch64. Please replace this machine.") - raise NotMatchedMachineTypeException() - - def install_component(self, component_name): - try: - self.install_component_handler(component_name) - except (FileNotFoundError, PermissionError, NotADirectoryError, OSError, IOError) as e: - LOGGER.error(f"Local machine {self.ip} occur Error: {str(e)}") - - def install_component_handler(self, component_name): - component_name_to_func_dict = { - "GCCforOpenEuler": self.default_install_component_handle, - "BiShengCompiler": self.default_install_component_handle, - "BiShengJDK17": self.default_install_component_handle, - "BiShengJDK8": self.default_install_component_handle, - "LkpTests": self.lkptest_install_component_handle, - "NonInvasiveSwitching": self.nis_install_component_handle, - "OpenEulerMirrorISO": self.deploy_iso_handle, - "UnOpenEulerMirrorISO": self.undeploy_iso_handle, - "A-FOT": self.install_a_fot, - } - self._local_exec_command(MKDIR_TMP_DEVKITDEPENDENCIES_CMD) - self._local_exec_command(YUM_INSTALL_LKP_DEPENDENCIES_CMD) - return component_name_to_func_dict.get(component_name)(component_name) - - def install_a_fot(self, component_name): - saved_path = os.path.join(constant.DEFAULT_PATH, "a-fot.tar.gz") - remote_file = os.path.abspath(os.path.join('/tmp', saved_path)) - LOGGER.debug(f"Copy local_file: {saved_path} to local machine {self.ip} remote_file: {remote_file}") - self._local_exec_command(f"/bin/cp -f {saved_path} {remote_file}") - self.nis_install_component_handle(component_name) - self.clear_tmp_file_at_local_machine([remote_file]) - - def nis_install_component_handle(self, component_name): - remote_file_list = [] - # 上传并执行 安装脚本, 校验安装结果脚本 - install_result = "" - for shell_file in SHELL_FILE_LIST: - sh_file_local_path = os.path.join(base_path("component"), component_name, shell_file) - sh_file_remote_path = os.path.join("/tmp/", constant.DEPENDENCY_DIR, component_name + shell_file) - sh_cmd = f"bash {sh_file_remote_path}" - execute_output = ( - self.transport_shell_file_and_execute( - sh_file_local_path=sh_file_local_path, - sh_file_remote_path=sh_file_remote_path, - sh_cmd=sh_cmd - )) - remote_file_list.append(sh_file_remote_path) - if shell_file == SHELL_FILE_LIST[1]: - install_result = execute_output - - if install_result == "true": - LOGGER.info(f"Local machine {self.ip} install {component_name} success.") - else: - LOGGER.error(f"Local machine {self.ip} install {component_name} failed.") - # 清理tmp临时文件 - self.clear_tmp_file_at_local_machine(remote_file_list) - - def lkptest_install_component_handle(self, component_name): - self._local_exec_command(MKDIR_TMP_DEVKITDEPENDENCIES_CMD) - self._local_exec_command(YUM_INSTALL_LKP_DEPENDENCIES_CMD) - - # 复制 tar.gz 文件 - LOGGER.info(f"Install component in local machine {self.ip}: {component_name}") - remote_file_list = [] - shell_dict = lkp_collection_map.get(component_name) - for shell_cmd in shell_dict: - url_and_save_path = shell_dict.get(shell_cmd) - local_file = url_and_save_path.get("save_path") - remote_file = os.path.abspath(os.path.join('/tmp', constant.DEPENDENCY_DIR, local_file.split('/')[-1])) - LOGGER.debug(f"Copy local_file: {local_file} to local machine {self.ip} remote_file: {remote_file}") - remote_file_list.append(remote_file) - self._local_exec_command(f"/bin/cp -f {local_file} {remote_file}") - # 上传并执行 安装脚本, 校验安装结果脚本 - install_result = "" - for shell_file in SHELL_FILE_LIST: - sh_file_local_path = os.path.join(base_path("component"), component_name, shell_file) - sh_file_remote_path = os.path.join("/tmp/", constant.DEPENDENCY_DIR, component_name + shell_file) - sh_cmd = f"bash {sh_file_remote_path} {remote_file_list[0]} {remote_file_list[1]}" - execute_output = ( - self.transport_shell_file_and_execute( - sh_file_local_path=sh_file_local_path, - sh_file_remote_path=sh_file_remote_path, - sh_cmd=sh_cmd - )) - remote_file_list.append(sh_file_remote_path) - if shell_file == SHELL_FILE_LIST[1]: - install_result = execute_output - - if install_result == "true": - LOGGER.info(f"Local machine {self.ip} install {component_name} success.") - else: - LOGGER.error(f"Local machine {self.ip} install {component_name} failed.") - # 清理tmp临时文件 - self.clear_tmp_file_at_local_machine(remote_file_list) - self.__install_component_on_lkptest("CompatibilityTesting") - self.__install_component_on_lkptest("DevkitDistribute") - - def __install_component_on_lkptest(self, component_name): - # 复制 tar.gz 文件 - LOGGER.info(f"Install component in local machine {self.ip}: {component_name}") - remote_file_list = [] - shell_dict = lkp_collection_map.get(component_name) - for shell_cmd in shell_dict: - url_and_save_path = shell_dict.get(shell_cmd) - local_file = url_and_save_path.get("save_path") - remote_file = os.path.abspath(os.path.join('/tmp', constant.DEPENDENCY_DIR, local_file.split('/')[-1])) - LOGGER.debug(f"Copy local_file: {local_file} to local machine {self.ip} remote_file: {remote_file}") - remote_file_list.append(remote_file) - self._local_exec_command(f"/bin/cp -f {local_file} {remote_file}") - # 上传并执行 安装脚本, 校验安装结果脚本 - install_result = "" - for shell_file in SHELL_FILE_LIST: - sh_file_local_path = os.path.join(base_path("component"), component_name, shell_file) - sh_file_remote_path = os.path.join("/tmp/", constant.DEPENDENCY_DIR, component_name + shell_file) - sh_cmd = f"bash {sh_file_remote_path} {remote_file_list[0]}" - execute_output = ( - self.transport_shell_file_and_execute( - sh_file_local_path=sh_file_local_path, - sh_file_remote_path=sh_file_remote_path, - sh_cmd=sh_cmd - )) - remote_file_list.append(sh_file_remote_path) - if shell_file == SHELL_FILE_LIST[1]: - install_result = execute_output - - if install_result == "true": - LOGGER.info(f"Local machine {self.ip} install {component_name} success.") - else: - LOGGER.error(f"Local machine {self.ip} install {component_name} failed.") - # 清理tmp临时文件 - self.clear_tmp_file_at_local_machine(remote_file_list) - - def deploy_iso_handle(self, component_name): - # 复制镜像文件 - LOGGER.info(f"Deploy component in local machine {self.ip}: {component_name}") - local_path = os.path.abspath(CommandLine.iso_path) - - # 执行 安装脚本, 校验安装结果脚本 - install_result = "" - for shell_file in SHELL_FILE_LIST: - sh_file_local_path = os.path.join(base_path("component"), component_name, shell_file) - sh_cmd = f"bash {sh_file_local_path} {local_path}" - if not os.path.exists(sh_file_local_path): - LOGGER.error(f"{sh_file_local_path} not exists.") - raise FileNotFoundError(f"local file {sh_file_local_path} not exists.") - - result = subprocess.run(f"{sh_cmd}".split(' '), - capture_output=True, shell=False) - output = result.stdout.decode().strip() - LOGGER.info(f"Local machine {self.ip} exec '{sh_cmd}' output: {output}") - if shell_file == SHELL_FILE_LIST[1]: - install_result = output - - if install_result == "true": - LOGGER.info(f"Remote machine {self.ip} deploy {component_name} success.") - else: - LOGGER.info(f"Remote machine {self.ip} deploy {component_name} failed.") - - def default_install_component_handle(self, component_name): - self._local_exec_command(MKDIR_TMP_DEVKITDEPENDENCIES_CMD) - - # 上传 组件压缩包和校验文件 - LOGGER.info(f"Install component in local machine {self.ip}: {component_name}") - remote_file_list = [] - shell_dict = component_collection_map.get(component_name) - for shell_cmd in shell_dict: - url_and_save_path = shell_dict.get(shell_cmd) - local_file = url_and_save_path.get("save_path") - remote_file = os.path.abspath(os.path.join('/tmp', local_file)) - LOGGER.debug(f"Copy local_file: {local_file} to local machine {self.ip} remote_file: {remote_file}") - remote_file_list.append(remote_file) - self._local_exec_command(f"/bin/cp -f {local_file} {remote_file}") - # 上传并执行 安装脚本, 校验安装结果脚本 - install_result = "" - for shell_file in SHELL_FILE_LIST: - sh_file_local_path = os.path.join(base_path("component"), component_name, shell_file) - sh_file_remote_path = os.path.join("/tmp/", constant.DEPENDENCY_DIR, component_name + shell_file) - sh_cmd = f"bash {sh_file_remote_path}" - execute_output = ( - self.transport_shell_file_and_execute( - sh_file_local_path=sh_file_local_path, - sh_file_remote_path=sh_file_remote_path, - sh_cmd=sh_cmd - )) - remote_file_list.append(sh_file_remote_path) - if shell_file == SHELL_FILE_LIST[1]: - install_result = execute_output - - if install_result == "true": - LOGGER.info(f"Local machine {self.ip} install {component_name} success.") - else: - LOGGER.error(f"Local machine {self.ip} install {component_name} failed.") - # 清理tmp临时文件 - self.clear_tmp_file_at_local_machine(remote_file_list) - - def _local_exec_command(self, cmd): - result = subprocess.run(cmd.split(' '), - capture_output=False, shell=False, stderr=subprocess.STDOUT) - if result.returncode == 0: - LOGGER.debug(f"Local machine {self.ip} exec '{cmd}' success.") - else: - LOGGER.error(f"Local machine {self.ip} exec '{cmd}' failed.") - raise OSError(PROMPT_MAP.get(cmd, f"Local machine {self.ip} exec '{cmd}' failed.")) - - def transport_shell_file_and_execute(self, sh_file_local_path, sh_file_remote_path, sh_cmd): - if not os.path.exists(sh_file_local_path): - LOGGER.error(f"{sh_file_local_path} not exists.") - raise FileNotFoundError(f"local file {sh_file_local_path} not exists.") - - LOGGER.debug(f"Copy local_file: {sh_file_local_path} to local machine {self.ip} " - f"remote_file: {sh_file_remote_path}") - subprocess.run(f"/bin/cp -f {sh_file_local_path} {sh_file_remote_path}".split(' '), - capture_output=False, shell=False, stderr=subprocess.STDOUT) - - result = subprocess.run(f"{sh_cmd}".split(' '), - capture_output=True, shell=False) - output = result.stdout.decode().strip() - LOGGER.info(f"Local machine {self.ip} exec '{sh_cmd}' output: {output}") - return output - - def clear_tmp_file_at_local_machine(self, remote_file_list): - LOGGER.debug(f"Clear tmp file at local machine {self.ip}") - for remote_file in remote_file_list: - try: - remote_file = os.path.realpath(remote_file) - if not remote_file.startswith(os.path.join("/tmp", constant.DEPENDENCY_DIR)): - continue - LOGGER.debug(f"Delete tmp file at local machine {self.ip}: {remote_file}") - subprocess.run(f"rm -fr {remote_file}".split(' '), - capture_output=False, shell=False, stderr=subprocess.STDOUT) - except Exception as e: - LOGGER.debug(str(e)) - - def do_nothing(self, component_name, sftp_client, ssh_client): - return - - def undeploy_iso_handle(self, component_name): - # 需要检查本地镜像是否安装成功 - self._local_exec_command(CHECK_MIRROR_INSTALL_STATUS) - - component_name = component_name.replace("Un", "") - LOGGER.info(f"Umount component in local machine {self.ip}: {component_name}") - - # 执行 卸载脚本 - for shell_file in ["uninstall.sh"]: - sh_file_local_path = os.path.join(base_path("component"), component_name, shell_file) - sh_cmd = f"bash {sh_file_local_path}" - if not os.path.exists(sh_file_local_path): - LOGGER.error(f"{sh_file_local_path} not exists.") - raise FileNotFoundError(f"local file {sh_file_local_path} not exists.") - - result = subprocess.run(f"{sh_cmd}".split(' '), - capture_output=True, shell=False) - output = result.stdout.decode().strip() - LOGGER.info(f"Local machine {self.ip} exec '{sh_cmd}' output: {output}") diff --git a/tools/install_dependency/src/machine/machine.py b/tools/install_dependency/src/machine/machine.py index 9779112f4cb0f5b24f99b963dad4cfe801deae74..7162a10eb49a6ca755d49e3f0bc89cfacfb617df 100644 --- a/tools/install_dependency/src/machine/machine.py +++ b/tools/install_dependency/src/machine/machine.py @@ -137,6 +137,7 @@ class Machine: "BiShengJDK8": self.default_install_component_handle, "LkpTests": self.lkptest_install_component_handle, "NonInvasiveSwitching": self.nis_install_component_handle, + "DevKitWeb": self.devkitweb_install_component_handle, "OpenEulerMirrorISO": self.deploy_iso_handle, "UnOpenEulerMirrorISO": self.undeploy_iso_handle, "A-FOT": self.install_a_fot, @@ -145,6 +146,32 @@ class Machine: self._remote_exec_command(CHECK_TMP_SPACE_SUFFICIENT_FOR_PACKAGE, ssh_client) return component_name_to_func_dict.get(component_name)(component_name, sftp_client, ssh_client) + def devkitweb_install_component_handle(self, component_name, sftp_client, ssh_client): + # 上传 tar.gz 文件 + LOGGER.info(f"Install component in remote machine {self.ip}: {component_name}") + remote_file_list = [] + shell_dict = component_collection_map.get(component_name) + + url_and_save_path = shell_dict.get("download file") + local_file = url_and_save_path.get("save_path") + remote_file = os.path.abspath(os.path.join('/opt', local_file.split('/')[-1])) + LOGGER.debug(f"Transport local_file: {local_file} to remote machine {self.ip} " + f"remote_file: {remote_file}") + remote_file_list.append(remote_file) + sftp_client.put(localpath=f"{local_file}", remotepath=f"{remote_file}") + + stdin, stdout, stderr = ssh_client.exec_command( + f"{os.path.join(base_path('component'), component_name, 'devkit_installer')} " + f"-i {self.ip} -u {self.user} -p {self.pkey}") + exit_status = stdout.channel.recv_exit_status() + if exit_status == 0: + LOGGER.debug(f"Remote machine {self.ip} exec 'devkit_installer' success.") + else: + LOGGER.error(f"Remote machine {self.ip} exec 'devkit_installer' failed.") + + # 清理tmp临时文件 + self.clear_tmp_file_at_remote_machine(ssh_client, remote_file_list) + def install_a_fot(self, component_name, sftp_client, ssh_client): saved_path = os.path.join(constant.DEFAULT_PATH, "a-fot.tar.gz") remote_file = os.path.abspath(os.path.join('/tmp', saved_path)) diff --git a/tools/install_dependency/src/utils.py b/tools/install_dependency/src/utils.py index b16c3aca3773d592c4c43ac290c1b2da95fb3833..b4b79084537ac2f0fa2589b529ffcf7ac9869f6a 100644 --- a/tools/install_dependency/src/utils.py +++ b/tools/install_dependency/src/utils.py @@ -45,6 +45,7 @@ def read_yaml_file(yaml_path): sys.exit(1) return yaml_dict + def generate_component_list(yaml_dict): component_list = list() for role in ROLE_LIST: