Skip to main content

infrahub_sdk.ctl.utils

Functions

init_logging

init_logging(debug: bool = False) -> None

handle_exception

handle_exception(exc: Exception, console: Console, exit_code: int) -> NoReturn

Handle exception in a different fashion based on its type.

catch_exception

catch_exception(console: Console | None = None, exit_code: int = 1) -> Callable[[Callable[..., T]], Callable[..., T | Coroutine[Any, Any, T]]]

Decorator to handle exception for commands.

execute_graphql_query

execute_graphql_query(query: str, variables_dict: dict[str, Any], repository_config: InfrahubRepositoryConfig, branch: str | None = None, debug: bool = False) -> dict
print_graphql_errors(console: Console, errors: list) -> None

parse_cli_vars

parse_cli_vars(variables: Optional[list[str]]) -> dict[str, str]

find_graphql_query

find_graphql_query(name: str, directory: str | Path = '.') -> str

render_action_rich

render_action_rich(value: str) -> str

get_fixtures_dir

get_fixtures_dir() -> Path

Get the directory which stores fixtures that are common to multiple unit/integration tests.

load_yamlfile_from_disk_and_exit

load_yamlfile_from_disk_and_exit(paths: list[Path], file_type: type[YamlFileVar], console: Console) -> list[YamlFileVar]

display_object_validate_format_success

display_object_validate_format_success(file: ObjectFile, console: Console) -> None

display_object_validate_format_error

display_object_validate_format_error(file: ObjectFile, error: ValidationError, console: Console) -> None