diff --git a/src/molecule/command/base.py b/src/molecule/command/base.py index 338e068f3..7393d08f2 100644 --- a/src/molecule/command/base.py +++ b/src/molecule/command/base.py @@ -21,11 +21,13 @@ import abc import collections -import glob import logging import os import shutil from typing import Any, Callable +import wcmatch.pathlib +import wcmatch.wcmatch +from wcmatch import glob import click from click_help_colors import HelpColorsCommand, HelpColorsGroup @@ -189,7 +191,12 @@ def get_configs(args, command_args, ansible_args=(), glob_str=MOLECULE_GLOB): command_args=command_args, ansible_args=ansible_args, ) - for c in glob.glob(glob_str) + for c in glob.glob( + glob_str, + flags=wcmatch.pathlib.GLOBSTAR + | wcmatch.pathlib.BRACE + | wcmatch.pathlib.DOTGLOB, + ) ] _verify_configs(configs, glob_str) diff --git a/src/molecule/command/list.py b/src/molecule/command/list.py index 09f419d95..5456a0017 100644 --- a/src/molecule/command/list.py +++ b/src/molecule/command/list.py @@ -64,7 +64,10 @@ def list(ctx, scenario_name, format): # pragma: no cover command_args = {"subcommand": subcommand, "format": format} statuses = [] - s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name) + s = scenarios.Scenarios( + base.get_configs(args, command_args, glob_str="**/molecule/*/molecule.yml"), + scenario_name, + ) for scenario in s: statuses.extend(base.execute_subcommand(scenario.config, subcommand))