Skip to content

Commit

Permalink
Fix bug with detection of configured role paths
Browse files Browse the repository at this point in the history
Since we adopted ansible-compat and removed our hardcoded
DEFAULT_ROLES_PATH constant the role path code was no longer working.

This is switching to use of ansible-compat runtime for gathering
the role path.
  • Loading branch information
ssbarnea committed Mar 14, 2022
1 parent 8dc810b commit e955bf0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ansiblelint/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
LoadingFailureRule,
RuntimeErrorRule,
)
from ansiblelint.app import get_app
from ansiblelint.config import options
from ansiblelint.constants import NESTED_TASK_KEYS, PLAYBOOK_TASK_KEYWORDS, FileType
from ansiblelint.errors import MatchError
Expand Down Expand Up @@ -444,10 +445,8 @@ def _rolepath(basedir: str, role: str) -> Optional[str]:
path_dwim(basedir, os.path.join("..", role)),
]

if constants.DEFAULT_ROLES_PATH:
search_locations = constants.DEFAULT_ROLES_PATH
if isinstance(search_locations, str):
search_locations = search_locations.split(os.pathsep)
search_locations = get_app().runtime.config["DEFAULT_ROLES_PATH"]
if search_locations and isinstance(search_locations, list):
for loc in search_locations:
loc = os.path.expanduser(loc)
possible_paths.append(path_dwim(loc, role))
Expand Down

0 comments on commit e955bf0

Please sign in to comment.