diff --git a/component/OpenEulerMirrorISO/uninstall.sh b/component/OpenEulerMirrorISO/uninstall.sh index b2e4c39c49f7206fd8e236d179307bf5a37c0bdb..97d2efcdacf08993a21489dafe8e7589516a713e 100644 --- a/component/OpenEulerMirrorISO/uninstall.sh +++ b/component/OpenEulerMirrorISO/uninstall.sh @@ -2,7 +2,7 @@ function resume_original_mirror() { rm -rf /etc/yum.repos.d/local.repo - mv -rf /etc/yum.repos.d/yum.repos.backup/* /etc/yum.repos.d/ + mv -f /etc/yum.repos.d/yum.repos.backup/* /etc/yum.repos.d/ rm -rf /etc/yum.repos.d/yum.repos.backup yum clean all diff --git a/tools/download_dependency/src/download_config.py b/tools/download_dependency/src/download_config.py index 9d4d3b524c166b330a2ac3cccf447ed1d02910de..1bc885d55143a5972b62996cd72f89ccea91e371 100644 --- a/tools/download_dependency/src/download_config.py +++ b/tools/download_dependency/src/download_config.py @@ -31,10 +31,6 @@ CompatibilityTesting = { "file": "https://gitee.com/openeuler/devkit-pipeline/releases/download/v0.2/compatibility_testing.tar.gz", } -DevkitDistribute = { - "component_name": "DevkitDistribute", - "file": "https://gitee.com/openeuler/devkit-pipeline/releases/download/v0.2/devkit_distribute.tar.gz", -} OpenEuler_2003_LTS = { "component_name": "openEuler_2003_LTS", diff --git a/tools/install_dependency/src/handler/base_yaml_check.py b/tools/install_dependency/src/handler/base_yaml_check.py index 7f5ce9aed42ec07c49925c80e5107836e63aed34..95ee72500c49ca84048d95fa5c83411104c7a47b 100644 --- a/tools/install_dependency/src/handler/base_yaml_check.py +++ b/tools/install_dependency/src/handler/base_yaml_check.py @@ -46,16 +46,8 @@ class BaseCheck(Handler): if not pkey_path: LOGGER.error("Yaml file content not correct. Empty pkey.") return False - - if not BaseCheck.validate_path(pkey_path) or not os.path.isfile(pkey_path): - LOGGER.error("Yaml file content not correct. Given pkey not exists.") - return False return True - - @staticmethod - def validate_path(path: str) -> bool: - return path.startswith('/') and path.find('../') == -1 and path.find('./') == -1 - + @staticmethod def check_machine_ip(data): for machine_type in (set(KLASS_DICT.keys()) & set(data.keys())): diff --git a/tools/install_dependency/src/machine/machine.py b/tools/install_dependency/src/machine/machine.py index f8b8f7d2994276035be19d0331ebbe35c6e10bbe..b25a3985b263a76f1f6bd3fe5d0aef66accbb6dc 100644 --- a/tools/install_dependency/src/machine/machine.py +++ b/tools/install_dependency/src/machine/machine.py @@ -8,11 +8,11 @@ import timeout_decorator import constant from command_line import CommandLine -from exception.connect_exception import CreatePkeyFailedException, ConnectRemoteException, \ - NotMatchedMachineTypeException +from exception.connect_exception import (CreatePkeyFailedException, ConnectRemoteException, + NotMatchedMachineTypeException) from download import component_collection_map from lkp_collect_map import lkp_collection_map -from utils import (base_path, MKDIR_TMP_DEVKITDEPENDENCIES_CMD, YUM_INSTALL_LKP_DEPENDENCIES_CMD, +from utils import (base_path, validate_path, MKDIR_TMP_DEVKITDEPENDENCIES_CMD, YUM_INSTALL_LKP_DEPENDENCIES_CMD, CHECK_HOME_SPACE_SUFFICIENT_FOR_MIRROR, CHECK_TMP_SPACE_SUFFICIENT_FOR_PACKAGE, CHECK_MIRROR_INSTALL_STATUS, PROMPT_MAP) @@ -56,6 +56,9 @@ class Machine: return sftp def transport_connect(self, user, pkey_path, password=None): + if not validate_path(pkey_path) or not os.path.isfile(pkey_path): + LOGGER.error("Yaml file content not correct. Given pkey not exists.") + raise ConnectRemoteException() try: # 指定本地的RSA私钥文件。如果建立密钥对时设置的有密码,password为设定的密码,如无不用指定password参数 pkey = paramiko.RSAKey.from_private_key_file(pkey_path, password=password) diff --git a/tools/install_dependency/src/utils.py b/tools/install_dependency/src/utils.py index 71278dc7eb91204edd6036981ca7b8c905870467..d249129dd2352a28d71133d6292f9d52d39126ae 100644 --- a/tools/install_dependency/src/utils.py +++ b/tools/install_dependency/src/utils.py @@ -16,6 +16,10 @@ PROMPT_MAP = { } +def validate_path(path: str) -> bool: + return path.startswith('/') and path.find('../') == -1 and path.find('./') == -1 + + def base_path(path): if getattr(sys, 'frozen', False): base_dir = sys._MEIPASS