Skip to content

Commit

Permalink
Adding a new module 'kernel' that holds sources common to both Cibyl …
Browse files Browse the repository at this point in the history
…and TripleO (#532)

* Creating 'kernel' module

* Adding module to build scripts.

* Moving 'tree' to kernel.

* Moving 'git' and 'github' to kernel.

* Moving tripleo utils to kernel tools.

* Moving cibyl utils to kernel

* Small change.

* Fixing mistake.
  • Loading branch information
jsanemet authored Oct 28, 2022
1 parent db96f87 commit c358f0a
Show file tree
Hide file tree
Showing 111 changed files with 188 additions and 719 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ COPY $CIBYL_ROOT/setup.py .
COPY $CIBYL_ROOT/setup.cfg .
COPY $CIBYL_ROOT/requirements.txt .

COPY $CIBYL_ROOT/cibyl ./cibyl
COPY $CIBYL_ROOT/kernel ./kernel
COPY $CIBYL_ROOT/tripleo ./tripleo
COPY $CIBYL_ROOT/cibyl ./cibyl

RUN python3 -m pip install .

Expand Down
2 changes: 1 addition & 1 deletion cibyl/cli/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from enum import IntFlag, auto
from typing import Optional

from cibyl.utils.dicts import subset
from kernel.tools.dicts import subset


class QueryType(IntFlag):
Expand Down
10 changes: 5 additions & 5 deletions cibyl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
from cibyl.exceptions.config import SchemaError
from cibyl.models.ci.system_factory import SystemType
from cibyl.utils import yaml
from cibyl.utils.files import get_first_available_file, is_file_available
from cibyl.utils.fs import File, cd_context_manager
from cibyl.utils.json import Draft7ValidatorFactory
from cibyl.utils.net import DownloadError, download_file
from kernel.tools.files import get_first_available_file, is_file_available
from kernel.tools.fs import File, cd_context_manager
from kernel.tools.json import Draft7ValidatorFactory
from kernel.tools.net import DownloadError, download_file

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -246,7 +246,7 @@ def from_url(
host. The definition is accessed and downloaded into the provided path.
Supported protocols are defined by
:func:`cibyl.utils.net.download_file`.
:func:`kernel.tools.net.download_file`.
Warnings
-------
Expand Down
4 changes: 2 additions & 2 deletions cibyl/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
select_source_method,
source_information_from_method)
from cibyl.utils.colors import Colors
from cibyl.utils.files import FileSearch
from cibyl.utils.reflection import get_classes_in, load_module
from kernel.tools.files import FileSearch
from kernel.tools.reflection import get_classes_in, load_module

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cibyl/models/ci/zuul/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from cibyl.models.attribute import AttributeDictValue, AttributeListValue
from cibyl.models.ci.base.job import Job as BaseJob
from cibyl.models.model import Model
from cibyl.utils.dicts import subset
from kernel.tools.dicts import subset


class Job(BaseJob):
Expand Down
6 changes: 3 additions & 3 deletions cibyl/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
select_source_method,
source_information_from_method)
from cibyl.sources.source_factory import SourceFactory
from cibyl.utils.dicts import intersect_models
from cibyl.utils.fs import File
from cibyl.utils.paths import resolve_home
from cibyl.utils.status_bar import StatusBar
from kernel.tools.dicts import intersect_models
from kernel.tools.fs import File
from kernel.tools.paths import resolve_home

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cibyl/outputs/cli/ci/env/impl/colored.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from cibyl.outputs.cli.ci.system.impls.zuul.colored import \
ColoredZuulSystemPrinter
from cibyl.outputs.cli.printer import ColoredPrinter
from cibyl.utils.strings import IndentedTextBuilder
from kernel.tools.text import IndentedTextBuilder

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cibyl/outputs/cli/ci/system/common/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from cibyl.models.ci.base.build import Build
from cibyl.outputs.cli.ci.system.common.status import get_status_colored
from cibyl.utils.colors import ColorPalette
from cibyl.utils.strings import IndentedTextBuilder
from cibyl.utils.time import as_minutes
from kernel.tools.text import IndentedTextBuilder


def has_status_section(build: Build) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion cibyl/outputs/cli/ci/system/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
AttributeValue)
from cibyl.models.model import Model
from cibyl.outputs.cli.printer import JSON, ColoredPrinter, SerializedPrinter
from cibyl.utils.strings import IndentedTextBuilder
from kernel.tools.text import IndentedTextBuilder

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cibyl/outputs/cli/ci/system/common/stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from cibyl.models.ci.base.stage import Stage
from cibyl.outputs.cli.ci.system.common.status import get_status_colored
from cibyl.utils.colors import ColorPalette
from cibyl.utils.strings import IndentedTextBuilder
from cibyl.utils.time import as_minutes
from kernel.tools.text import IndentedTextBuilder


def print_stage(stage: Stage, palette: ColorPalette,
Expand Down
4 changes: 2 additions & 2 deletions cibyl/outputs/cli/ci/system/impls/base/colored.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
from cibyl.outputs.cli.ci.system.utils.sorting.jobs import SortJobsByName
from cibyl.outputs.cli.printer import ColoredPrinter
from cibyl.utils.colors import ColorPalette, DefaultPalette
from cibyl.utils.sorting import BubbleSortAlgorithm, SortingAlgorithm
from cibyl.utils.strings import IndentedTextBuilder
from kernel.tools.sorting import BubbleSortAlgorithm, SortingAlgorithm
from kernel.tools.text import IndentedTextBuilder

LOG = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions cibyl/outputs/cli/ci/system/impls/jobs/colored.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
from cibyl.outputs.cli.ci.system.common.stages import print_stage
from cibyl.outputs.cli.ci.system.impls.base.colored import \
ColoredBaseSystemPrinter
from cibyl.utils.sorting import nsort, sort
from cibyl.utils.strings import IndentedTextBuilder
from cibyl.utils.time import as_minutes
from kernel.tools.sorting import nsort, sort
from kernel.tools.text import IndentedTextBuilder


class ColoredJobsSystemPrinter(ColoredBaseSystemPrinter):
Expand Down
4 changes: 2 additions & 2 deletions cibyl/outputs/cli/ci/system/impls/zuul/colored/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
ProjectCascade
from cibyl.outputs.cli.ci.system.impls.zuul.colored.trees.factory import \
HierarchicalTreeFactory
from cibyl.utils.sorting import sort
from cibyl.utils.strings import IndentedTextBuilder
from kernel.tools.sorting import sort
from kernel.tools.text import IndentedTextBuilder

LOG = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

from cibyl.models.ci.zuul.job import Job
from cibyl.outputs.cli.printer import ColoredPrinter
from cibyl.utils.strings import IndentedTextBuilder
from cibyl.utils.tree import Tree
from kernel.tools.text import IndentedTextBuilder
from kernel.tools.tree import Tree


class HierarchyCascade(ColoredPrinter):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from cibyl.outputs.cli.ci.system.common.models import (get_plugin_section,
has_plugin_section)
from cibyl.outputs.cli.printer import ColoredPrinter
from cibyl.utils.strings import IndentedTextBuilder
from cibyl.utils.time import as_minutes
from kernel.tools.text import IndentedTextBuilder


class JobCascade(ColoredPrinter):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from cibyl.outputs.cli.ci.system.common.builds import get_status_section
from cibyl.outputs.cli.printer import ColoredPrinter
from cibyl.utils.filtering import apply_filters
from cibyl.utils.strings import IndentedTextBuilder
from kernel.tools.text import IndentedTextBuilder


class ProjectCascade(ColoredPrinter):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from overrides import overrides

from cibyl.models.ci.zuul.job import Job
from cibyl.utils.tree import Leaf, Tree
from kernel.tools.tree import Leaf, Tree

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cibyl/outputs/cli/ci/system/utils/sorting/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# under the License.
"""
from cibyl.models.ci.base.build import Build
from cibyl.utils.sorting import Comparator
from kernel.tools.sorting import Comparator


class SortBuildsByUUID(Comparator):
Expand Down
2 changes: 1 addition & 1 deletion cibyl/outputs/cli/ci/system/utils/sorting/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# under the License.
"""
from cibyl.models.ci.base.job import Job
from cibyl.utils.sorting import Comparator
from kernel.tools.sorting import Comparator


class SortJobsByName(Comparator):
Expand Down
4 changes: 2 additions & 2 deletions cibyl/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
from cibyl.outputs.cli.printer import JSON, ColoredPrinter, SerializedPrinter
from cibyl.sources.plugins import SourceExtension
from cibyl.sources.source_factory import SourceFactory
from cibyl.utils.files import FileSearch
from cibyl.utils.filtering import apply_filters
from cibyl.utils.reflection import get_classes_in, load_module
from kernel.tools.files import FileSearch
from kernel.tools.reflection import get_classes_in, load_module

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cibyl/plugins/openstack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from cibyl.plugins import PluginTemplate
from cibyl.plugins.openstack.deployment import Deployment
from cibyl.plugins.openstack.printers.router import PrinterRouter
from cibyl.utils.dicts import subset
from kernel.tools.dicts import subset

PLUGIN_ARGUMENTS = ('release', 'spec', 'infra_type', 'nodes', 'controllers',
'computes', 'node_name', 'role', 'containers',
Expand Down
2 changes: 1 addition & 1 deletion cibyl/plugins/openstack/printers/colored.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from cibyl.plugins.openstack.network import Network
from cibyl.plugins.openstack.printers import OSPrinter
from cibyl.plugins.openstack.storage import Storage
from cibyl.utils.strings import IndentedTextBuilder
from kernel.tools.text import IndentedTextBuilder


class OSColoredPrinter(ColoredPrinter, OSPrinter):
Expand Down
2 changes: 1 addition & 1 deletion cibyl/plugins/openstack/sources/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from cibyl.plugins.openstack.test_collection import TestCollection
from cibyl.sources.plugins import SourceExtension
from cibyl.sources.source import speed_index
from cibyl.utils.dicts import chunk_dictionary_into_lists
from cibyl.utils.filtering import IP_PATTERN
from kernel.tools.dicts import chunk_dictionary_into_lists


class ElasticSearch(SourceExtension):
Expand Down
4 changes: 2 additions & 2 deletions cibyl/plugins/openstack/sources/jenkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
from cibyl.sources.jenkins import LOG, detect_job_info_regex, filter_jobs
from cibyl.sources.plugins import SourceExtension
from cibyl.sources.source import speed_index
from cibyl.utils.dicts import subset
from cibyl.utils.files import get_file_name_from_path
from cibyl.utils.filtering import (DEPLOYMENT_PATTERN, DVR_PATTERN_NAME,
IP_PATTERN, NETWORK_BACKEND_PATTERN,
RELEASE_PATTERN, SERVICES_PATTERN,
TOPOLOGY_PATTERN, apply_filters,
filter_topology,
satisfy_case_insensitive_match,
satisfy_exact_match, satisfy_regex_match)
from kernel.tools.dicts import subset
from kernel.tools.files import get_file_name_from_path

# shorthand for the type that will hold the job information obtained from the
# Jenkins API response
Expand Down
2 changes: 1 addition & 1 deletion cibyl/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from cibyl.cli.query import QueryType
from cibyl.models.ci.base.environment import Environment
from cibyl.outputs.cli.ci.env.factory import CIPrinterFactory
from cibyl.utils.fs import File
from kernel.tools.fs import File

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cibyl/sources/elasticsearch/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
from cibyl.sources.elasticsearch.client import ElasticSearchClient
from cibyl.sources.server import ServerSource
from cibyl.sources.source import speed_index
from cibyl.utils.dicts import chunk_dictionary_into_lists
from cibyl.utils.filtering import (apply_filters, matches_regex,
satisfy_exact_match, satisfy_regex_match)
from cibyl.utils.models import has_builds_job, has_tests_job
from kernel.tools.dicts import chunk_dictionary_into_lists

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cibyl/sources/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from cibyl.cli.argument import Argument
from cibyl.exceptions.source import NoSupportedSourcesFound, NoValidSources
from cibyl.utils.attrdict import AttrDict
from kernel.tools.attrdict import AttrDict

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cibyl/sources/zuul/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from cibyl.sources.zuul.apis.providers import JobsProvider, PipelinesProvider
from cibyl.sources.zuul.utils.artifacts import Artifact, ArtifactKind
from cibyl.sources.zuul.utils.tests.types import TestSuite
from cibyl.utils.io import Closeable
from kernel.tools.io import Closeable


class ZuulAPIError(SourceException):
Expand Down
2 changes: 1 addition & 1 deletion cibyl/sources/zuul/apis/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from requests import HTTPError, Session

from cibyl.sources.zuul.apis import ZuulAPIError, ZuulBuildAPI
from cibyl.utils.io import Closeable
from kernel.tools.io import Closeable


class ZuulSession(Closeable):
Expand Down
2 changes: 1 addition & 1 deletion cibyl/sources/zuul/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from cibyl.sources.zuul.queries.composition.factory import \
AggregatedQueryFactory
from cibyl.sources.zuul.queries.modifiers.factory import QueryModifierFactory
from cibyl.utils.dicts import subset
from kernel.tools.dicts import subset


class Zuul(ServerSource):
Expand Down
2 changes: 1 addition & 1 deletion cibyl/sources/zuul/transactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from cibyl.sources.zuul.utils.tests.tempest.types import TempestTest
from cibyl.sources.zuul.utils.tests.types import Test, TestResult, TestSuite
from cibyl.utils.filtering import apply_filters, matches_regex
from cibyl.utils.urls import URL
from kernel.tools.urls import URL


class Request(ABC):
Expand Down
2 changes: 1 addition & 1 deletion cibyl/sources/zuul/utils/artifacts/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from cibyl.sources.zuul.apis.http import ZuulHTTPBuildAPI as Build
from cibyl.sources.zuul.utils.artifacts import ArtifactError
from cibyl.utils.filtering import matches_regex
from cibyl.utils.net import download_into_memory
from kernel.tools.net import download_into_memory


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion cibyl/sources/zuul/utils/builds/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""
from cibyl.sources.zuul.apis import ZuulBuildAPI as Build
from cibyl.sources.zuul.utils.artifacts.manifest import ManifestFile
from cibyl.utils.urls import URL
from kernel.tools.urls import URL


def get_url_to_build_file(build: Build, file: ManifestFile) -> URL:
Expand Down
4 changes: 2 additions & 2 deletions cibyl/sources/zuul/utils/tests/tempest/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
from cibyl.sources.zuul.utils.builds import get_url_to_build_file
from cibyl.sources.zuul.utils.tests.tempest.types import TempestTest
from cibyl.sources.zuul.utils.tests.types import TestResult, TestSuite
from cibyl.utils.net import download_into_memory
from tripleo.utils.urls import URL
from kernel.tools.net import download_into_memory
from kernel.tools.urls import URL


@dataclass
Expand Down
Loading

0 comments on commit c358f0a

Please sign in to comment.