Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KPOps 6.0.0 #496

Merged
merged 9 commits into from
Jun 6, 2024
8 changes: 6 additions & 2 deletions kpops/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
from collections.abc import Iterable, Iterator
from pathlib import Path

from kpops.api.file_type import KpopsFileType

PIPELINE_YAML = KpopsFileType.PIPELINE.as_yaml_file()


def collect_pipeline_paths(pipeline_paths: Iterable[Path]) -> Iterator[Path]:
"""Generate paths to pipeline files.
Expand All @@ -15,10 +19,10 @@ def collect_pipeline_paths(pipeline_paths: Iterable[Path]) -> Iterator[Path]:
:raises: ValueError: If `pipeline_path` is neither a file nor a directory.
"""
for pipeline_path in pipeline_paths:
if pipeline_path.is_file():
if pipeline_path.is_file() and pipeline_path.name == PIPELINE_YAML:
raminqaf marked this conversation as resolved.
Show resolved Hide resolved
yield pipeline_path
elif pipeline_path.is_dir():
yield from sorted(pipeline_path.glob("**/pipeline.yaml"))
yield from sorted(pipeline_path.glob(f"**/{PIPELINE_YAML}"))
else:
msg = f"The entered pipeline path '{pipeline_path}' should be a directory or file."
raise ValueError(msg)
Loading