Skip to content

Commit

Permalink
Allow molecule to list scenarios present under molecule directory wit…
Browse files Browse the repository at this point in the history
…hin a collection
  • Loading branch information
audgirka committed Aug 7, 2023
1 parent 00461c6 commit 2c7ddf8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/molecule/command/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion src/molecule/command/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 2c7ddf8

Please sign in to comment.