From 89c4635162c25cc8b69e6e788b4c47fc0354045c Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 22 Feb 2023 15:15:00 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20change=20secrett=20=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=20(#9686)?= 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 | 6 ++++-- apps/accounts/automations/push_account/manager.py | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/accounts/automations/change_secret/manager.py b/apps/accounts/automations/change_secret/manager.py index a6c14fa23..6cd36f080 100644 --- a/apps/accounts/automations/change_secret/manager.py +++ b/apps/accounts/automations/change_secret/manager.py @@ -87,7 +87,9 @@ class ChangeSecretManager(AccountBasePlaybookManager): accounts = accounts.filter(secret_type=self.secret_type) if not accounts: - print('没有发现待改密账号: %s 用户名: %s 类型: %s' % (asset.name, account.username, self.secret_type)) + print('没有发现待改密账号: %s 用户名: %s 类型: %s' % ( + asset.name, self.snapshot_account_usernames, self.secret_type + )) return [] method_attr = getattr(automation, self.method_type() + '_method') @@ -98,7 +100,7 @@ class ChangeSecretManager(AccountBasePlaybookManager): host['secret_type'] = self.secret_type if asset.type == HostTypes.WINDOWS and self.secret_type == SecretType.SSH_KEY: - print(f'Windows {asset} does not support ssh key push \n') + print(f'Windows {asset} does not support ssh key push') return inventory_hosts for account in accounts: diff --git a/apps/accounts/automations/push_account/manager.py b/apps/accounts/automations/push_account/manager.py index 42a53fcb1..770ca9d25 100644 --- a/apps/accounts/automations/push_account/manager.py +++ b/apps/accounts/automations/push_account/manager.py @@ -59,7 +59,6 @@ class PushAccountManager(ChangeSecretManager, AccountBasePlaybookManager): accounts = asset.accounts.all() accounts = self.get_accounts(account, accounts) - inventory_hosts = [] host['secret_type'] = self.secret_type if asset.type == HostTypes.WINDOWS and self.secret_type == SecretType.SSH_KEY: