Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions infrahub_sdk/ctl/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ..ctl import config
from ..ctl.client import initialize_client
from ..ctl.repository import get_repository_config
from ..ctl.utils import execute_graphql_query, parse_cli_vars
from ..ctl.utils import execute_graphql_query, init_logging, parse_cli_vars
from ..exceptions import ModuleImportError
from ..node import InfrahubNode

Expand All @@ -20,11 +20,12 @@
async def run(
generator_name: str,
path: str, # noqa: ARG001
debug: bool, # noqa: ARG001
debug: bool,
list_available: bool,
branch: str | None = None,
variables: list[str] | None = None,
) -> None:
init_logging(debug=debug)

Check warning on line 28 in infrahub_sdk/ctl/generator.py

View check run for this annotation

Codecov / codecov/patch

infrahub_sdk/ctl/generator.py#L28

Added line #L28 was not covered by tests
repository_config = get_repository_config(Path(config.INFRAHUB_REPO_CONFIG_FILE))

if list_available or not generator_name:
Expand All @@ -34,7 +35,6 @@
generator_config = repository_config.get_generator_definition(name=generator_name)

console = Console()

relative_path = str(generator_config.file_path.parent) if generator_config.file_path.parent != Path() else None

try:
Expand Down
3 changes: 3 additions & 0 deletions infrahub_sdk/generator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import logging
import os
from abc import abstractmethod
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -27,6 +28,7 @@
generator_instance: str = "",
params: dict | None = None,
convert_query_response: bool = False,
logger: logging.Logger | None = None,
) -> None:
self.query = query
self.branch = branch
Expand All @@ -41,6 +43,7 @@
self._related_nodes: list[InfrahubNode] = []
self.infrahub_node = infrahub_node
self.convert_query_response = convert_query_response
self.logger = logger if logger else logging.getLogger("infrahub.tasks")

Check warning on line 46 in infrahub_sdk/generator.py

View check run for this annotation

Codecov / codecov/patch

infrahub_sdk/generator.py#L46

Added line #L46 was not covered by tests

@property
def store(self) -> NodeStore:
Expand Down