Skip to content

Commit

Permalink
Move common openshift utils to ocviapy, also isort
Browse files Browse the repository at this point in the history
  • Loading branch information
bsquizz committed May 23, 2022
1 parent 485e9b5 commit 2322de6
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 823 deletions.
50 changes: 23 additions & 27 deletions bonfire/bonfire.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,48 @@
#!/usr/bin/env python3

import click
import json
import logging
import sys
import warnings
from functools import wraps

import click
from ocviapy import apply_config
from tabulate import tabulate
from wait_for import TimedOutError
from functools import wraps

import bonfire.config as conf
from bonfire.qontract import get_apps_for_env, sub_refs
from bonfire.local import get_local_apps
from bonfire.namespaces import (
Namespace,
extend_namespace,
get_namespaces,
release_reservation,
reserve_namespace,
)
from bonfire.openshift import (
apply_config,
wait_for_all_resources,
wait_for_db_resources,
check_for_existing_reservation,
find_clowd_env_for_ns,
get_reservation,
has_clowder,
has_ns_operator,
wait_for_all_resources,
wait_for_clowd_env_target_ns,
wait_for_db_resources,
wait_on_cji,
get_reservation,
check_for_existing_reservation,
whoami,
has_ns_operator,
has_clowder,
)
from bonfire.processor import TemplateProcessor, process_clowd_env, process_iqe_cji
from bonfire.qontract import get_apps_for_env, sub_refs
from bonfire.secrets import import_secrets_from_dir
from bonfire.utils import (
FatalError,
split_equals,
find_what_depends_on,
validate_time_string,
check_pypi,
find_what_depends_on,
get_version,
split_equals,
validate_time_string,
)
from bonfire.local import get_local_apps
from bonfire.processor import (
TemplateProcessor,
process_clowd_env,
process_iqe_cji,
)
from bonfire.namespaces import (
Namespace,
get_namespaces,
extend_namespace,
reserve_namespace,
release_reservation,
)
from bonfire.secrets import import_secrets_from_dir

log = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions bonfire/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import logging
import os
from pathlib import Path
from pkg_resources import resource_filename
import shutil
import subprocess
from pathlib import Path

from dotenv import load_dotenv
from pkg_resources import resource_filename

from bonfire.utils import load_file, get_config_path, FatalError
from bonfire.utils import FatalError, get_config_path, load_file

log = logging.getLogger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion bonfire/local.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import logging

import yaml

from bonfire.utils import RepoFile, get_dupes, FatalError
from bonfire.utils import FatalError, RepoFile, get_dupes

log = logging.getLogger(__name__)

Expand Down
18 changes: 5 additions & 13 deletions bonfire/namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@
import datetime
import logging

from ocviapy import apply_config, get_all_namespaces, get_json, on_k8s
from wait_for import TimedOutError

import bonfire.config as conf
from bonfire.openshift import (
apply_config,
on_k8s,
get_all_namespaces,
get_json,
get_reservation,
get_all_reservations,
wait_on_reservation,
whoami,
)
from bonfire.openshift import get_all_reservations, get_reservation, wait_on_reservation, whoami
from bonfire.processor import process_reservation
from bonfire.utils import FatalError, hms_to_seconds
from wait_for import TimedOutError


log = logging.getLogger(__name__)
TIME_FMT = "%Y-%m-%dT%H:%M:%SZ"
Expand Down Expand Up @@ -208,7 +200,7 @@ def get_namespaces(available=False, mine=False):
mine (bool) -- return only namespaces owned by current user
"""
log.debug("get_namespaces(available=%s, mine=%s)", available, mine)
all_namespaces = get_all_namespaces()
all_namespaces = get_all_namespaces(label="operator-ns")
all_clowdapps = get_json("clowdapp", "--all-namespaces").get("items", [])
all_res = get_all_reservations()

Expand Down
Loading

0 comments on commit 2322de6

Please sign in to comment.