From 7b9523d6be72253f1954e3bdbe0ace943887a152 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 8 Feb 2023 20:39:24 +0800 Subject: [PATCH] perf: ansible accounts is_active (#9473) Co-authored-by: feng <1304903146@qq.com> --- apps/ops/ansible/inventory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/ops/ansible/inventory.py b/apps/ops/ansible/inventory.py index a340b510d..f1ea649e6 100644 --- a/apps/ops/ansible/inventory.py +++ b/apps/ops/ansible/inventory.py @@ -139,7 +139,9 @@ class JMSInventory: return host def select_account(self, asset): - accounts = list(asset.accounts.all()) + accounts = list(asset.accounts.all(is_active=True)) + if not accounts: + return None account_selected = None account_usernames = self.account_prefer