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

feat: add --filter-status option for controlling which landing zones are listed #239

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cubi_tk/sodar/lz_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ def setup_argparse(cls, parser: argparse.ArgumentParser) -> None:
help="Format string for printing, e.g. %%(uuid)s",
)

status = ["ACTIVE", "FAILED", "VALIDATING"]
parser.add_argument(
"--filter-status",
dest="filter_status",
default=set(status),
action="append",
choices=status,
help="Filter landing zone by status. Defaults to listing all.",
)

parser.add_argument("project_uuid", help="UUID of project to create the landing zone in.")

@classmethod
Expand Down Expand Up @@ -101,7 +111,7 @@ def execute(self) -> typing.Optional[int]:
key=lambda lz: lz.date_modified,
)
for lz in existing_lzs:
if lz.status != "ACTIVE":
if lz.status not in self.args.filter_status:
continue
values = cattr.unstructure(lz)
if self.args.format_string:
Expand Down
Loading