From 09432b01a7acac15b00eee5bfa6eb6d714d27dfe Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 26 Feb 2024 14:47:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=8A=A8=E5=8C=96=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=AF=86=E9=92=A5=E4=B8=BA=20None=20=E6=8A=A5?= =?UTF-8?q?=E9=94=99=20(#12709)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/accounts/automations/change_secret/manager.py | 4 ++++ apps/accounts/automations/verify_account/manager.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/accounts/automations/change_secret/manager.py b/apps/accounts/automations/change_secret/manager.py index ee6aa436f..d85e057b5 100644 --- a/apps/accounts/automations/change_secret/manager.py +++ b/apps/accounts/automations/change_secret/manager.py @@ -119,6 +119,10 @@ class ChangeSecretManager(AccountBasePlaybookManager): else: new_secret = self.get_secret(secret_type) + if new_secret is None: + print(f'new_secret is None, account: {account}') + continue + if self.record_id is None: recorder = ChangeSecretRecord( asset=asset, account=account, execution=self.execution, diff --git a/apps/accounts/automations/verify_account/manager.py b/apps/accounts/automations/verify_account/manager.py index 794cf4ff6..94be53b89 100644 --- a/apps/accounts/automations/verify_account/manager.py +++ b/apps/accounts/automations/verify_account/manager.py @@ -51,6 +51,9 @@ class VerifyAccountManager(AccountBasePlaybookManager): h['name'] += '(' + account.username + ')' self.host_account_mapper[h['name']] = account secret = account.secret + if secret is None: + print(f'account {account.name} secret is None') + continue private_key_path = None if account.secret_type == SecretType.SSH_KEY: @@ -62,7 +65,7 @@ class VerifyAccountManager(AccountBasePlaybookManager): 'name': account.name, 'username': account.username, 'secret_type': account.secret_type, - 'secret': account.escape_jinja2_syntax(secret), + 'secret': account.escape_jinja2_syntax(secret), 'private_key_path': private_key_path, 'become': account.get_ansible_become_auth(), }