Skip to content

Commit

Permalink
fix module search for a module redirected from major collection (#211)
Browse files Browse the repository at this point in the history
Signed-off-by: hirokuni-kitahara <[email protected]>
  • Loading branch information
hirokuni-kitahara authored Nov 11, 2023
1 parent 25a01f3 commit 0e32814
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ansible_risk_insight/risk_assessment_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,13 @@ def search_module(self, name, exact_match=False, max_match=-1, collection_name="
# look for the module index with FQCN (only when `name` is FQCN)
if "." in name:
for possible_index in self.module_index[short_name]:
if possible_index["fqcn"] == name:
# use the first one normally
if not found_index and possible_index["fqcn"] == name:
found_index = possible_index

# but if a non-deprecated one is found, use it
if possible_index["fqcn"] == name and not possible_index["deprecated"]:
found_index = possible_index
break

# if any candidates don't match with FQCN, use the first index
if not found_index:
Expand Down

0 comments on commit 0e32814

Please sign in to comment.