Skip to content

Commit

Permalink
Add Nebari class
Browse files Browse the repository at this point in the history
  • Loading branch information
iameskild committed Jun 26, 2023
1 parent ca32e35 commit 11ac6b9
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 230 deletions.
10 changes: 0 additions & 10 deletions src/_nebari/__main__.py

This file was deleted.

101 changes: 0 additions & 101 deletions src/_nebari/cli.py

This file was deleted.

48 changes: 0 additions & 48 deletions src/_nebari/stages/base.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import contextlib
import inspect
import itertools
import os
import pathlib
import re
from typing import Any, Dict, List, Tuple

from _nebari.provider import terraform
Expand Down Expand Up @@ -107,49 +105,3 @@ def destroy(
if not ignore_errors:
raise e
status["stages/" + self.name] = False


def get_available_stages(
exclude_default_stages: bool = False, exclude_stages: List[str] = []
):
from nebari.plugins import load_plugins, pm

DEFAULT_STAGES = [
"_nebari.stages.bootstrap",
"_nebari.stages.terraform_state",
"_nebari.stages.infrastructure",
"_nebari.stages.kubernetes_initialize",
"_nebari.stages.kubernetes_ingress",
"_nebari.stages.kubernetes_keycloak",
"_nebari.stages.kubernetes_keycloak_configuration",
"_nebari.stages.kubernetes_services",
"_nebari.stages.nebari_tf_extensions",
]

if not exclude_default_stages:
load_plugins(DEFAULT_STAGES)

stages = itertools.chain.from_iterable(pm.hook.nebari_stage())

# order stages by priority
sorted_stages = sorted(stages, key=lambda s: s.priority)

# filter out duplicate stages with same name (keep highest priority)
visited_stage_names = set()
filtered_stages = []
for stage in reversed(sorted_stages):
if stage.name in visited_stage_names:
continue
filtered_stages.insert(0, stage)
visited_stage_names.add(stage.name)

# filter out stages which match excluded stages
included_stages = []
for stage in filtered_stages:
for exclude_stage in exclude_stages:
if re.fullmatch(exclude_stage, stage.name) is not None:
break
else:
included_stages.append(stage)

return included_stages
42 changes: 0 additions & 42 deletions src/_nebari/subcommands/info.py

This file was deleted.

5 changes: 2 additions & 3 deletions src/nebari/__main__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from _nebari.cli import create_cli
from nebari.plugins import Nebari


def main():
cli = create_cli()
cli()
Nebari()


if __name__ == "__main__":
Expand Down
Loading

0 comments on commit 11ac6b9

Please sign in to comment.