From c5ef11bc9cb848341e5ad3715ddbe7c63aecd878 Mon Sep 17 00:00:00 2001 From: HUANG SIZHE Date: Wed, 28 Jul 2021 11:08:48 +0800 Subject: [PATCH] update --- CHANGELOG.md | 1 - portainer_deploy_tool/create_or_update_stack.py | 6 +----- portainer_deploy_tool/update_service_by_webhook.py | 6 +----- portainer_deploy_tool/update_service_in_stack.py | 6 +----- portainer_deploy_tool/utils.py | 7 +------ 5 files changed, 4 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b8893c..9020039 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,6 @@ ## 接口修改 -+ 新增全局flag`not_verify`用于跳过https的验证 + 子命令`updateservicebywebhook`的`tokens`参数现在是位置参数 + 子命令`updateservicebywebhook`现在可以用执行目录下的`update_service_by_webhooks_config.json`文件作为配置 + 子命令`createorupdatestack`的`endpoints`参数现在是位置参数 diff --git a/portainer_deploy_tool/create_or_update_stack.py b/portainer_deploy_tool/create_or_update_stack.py index 59ca85d..0c7f073 100644 --- a/portainer_deploy_tool/create_or_update_stack.py +++ b/portainer_deploy_tool/create_or_update_stack.py @@ -288,11 +288,7 @@ def do_main(self) -> None: repository_password = self.config.get("repository_password") retry_max_times = self.config.get("retry_max_times") retry_interval_backoff_factor = self.config.get("retry_interval_backoff_factor") - not_verify = retry_interval_backoff_factor = self.config.get("not_verify") - if not_verify: - rq = requests.Session(verify=False) - else: - rq = requests.Session() + rq = requests.Session() if retry_max_times and int(retry_max_times) > 0: rq.mount('https://', HTTPAdapter(max_retries=Retry(total=int(retry_max_times), backoff_factor=retry_interval_backoff_factor, method_whitelist=frozenset(['GET', 'POST', 'PUT'])))) # 初始化log diff --git a/portainer_deploy_tool/update_service_by_webhook.py b/portainer_deploy_tool/update_service_by_webhook.py index 567c691..d13a634 100644 --- a/portainer_deploy_tool/update_service_by_webhook.py +++ b/portainer_deploy_tool/update_service_by_webhook.py @@ -41,11 +41,7 @@ def do_main(self) -> None: tokens = self.config["tokens"] retry_max_times = self.config.get("retry_max_times") retry_interval_backoff_factor = self.config.get("retry_interval_backoff_factor", 0) - not_verify = retry_interval_backoff_factor = self.config.get("not_verify") - if not_verify: - rq = requests.Session(verify=False) - else: - rq = requests.Session() + rq = requests.Session() if retry_max_times and int(retry_max_times) > 0: rq.mount('https://', HTTPAdapter(max_retries=Retry(total=int(retry_max_times), backoff_factor=retry_interval_backoff_factor, method_whitelist=frozenset(['GET', 'POST', 'PUT'])))) log.initialize_for_app(app_name="UpdateStack", log_level=log_level) diff --git a/portainer_deploy_tool/update_service_in_stack.py b/portainer_deploy_tool/update_service_in_stack.py index e80d984..4b720dc 100644 --- a/portainer_deploy_tool/update_service_in_stack.py +++ b/portainer_deploy_tool/update_service_in_stack.py @@ -239,11 +239,7 @@ def do_main(self) -> None: deploy_path = self.config["deploy_path"] retry_max_times = self.config.get("retry_max_times") retry_interval_backoff_factor = self.config.get("retry_interval_backoff_factor") - not_verify = retry_interval_backoff_factor = self.config.get("not_verify") - if not_verify: - rq = requests.Session(verify=False) - else: - rq = requests.Session() + rq = requests.Session() if retry_max_times and int(retry_max_times) > 0: rq.mount('https://', HTTPAdapter(max_retries=Retry(total=int(retry_max_times), backoff_factor=retry_interval_backoff_factor, method_whitelist=frozenset(['GET', 'POST', 'PUT'])))) log.initialize_for_app(app_name="UpdateStack", log_level=log_level) diff --git a/portainer_deploy_tool/utils.py b/portainer_deploy_tool/utils.py index 5903f04..b162e39 100644 --- a/portainer_deploy_tool/utils.py +++ b/portainer_deploy_tool/utils.py @@ -22,12 +22,7 @@ "type": "number", "description": "重试间隔时间,的参数,间隔时间位`{backoff factor} * (2 ** ({number of total retries} - 1))`", "default": 0.1 - }, - "not_verify": { - "type": "boolean", - "description": "是否不验证ssl", - "default": False - }, + } }