Skip to content

Commit

Permalink
fix module search issue when the first cand is deprecated (#219)
Browse files Browse the repository at this point in the history
Signed-off-by: hirokuni-kitahara <[email protected]>
  • Loading branch information
hirokuni-kitahara authored Feb 19, 2024
1 parent ca3352b commit 246b439
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ansible_risk_insight/risk_assessment_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,11 @@ def search_module(self, name, exact_match=False, max_match=-1, collection_name="

# if any candidates don't match with FQCN, use the first index
if not found_index:
found_index = self.module_index[short_name][0]
non_deprecated_cands = [idx for idx in self.module_index[short_name] if not idx["deprecated"]]
if non_deprecated_cands:
found_index = non_deprecated_cands[0]
else:
found_index = self.module_index[short_name][0]

modules_json_list = []
if from_indices:
Expand Down

0 comments on commit 246b439

Please sign in to comment.