From 9abe527dbf3312660e81d30c7862dc6650763dcb Mon Sep 17 00:00:00 2001 From: wvandeun Date: Fri, 17 Jan 2025 17:10:15 +0100 Subject: [PATCH] change env vars used for the infrahubctl command to align with SDK INFRAHUBCTL_TIMEOUT > INFRAHUB_TIMEOUT INFRAHUBCTL_CONCURRENT_EXECUTION > INFRAHUBCTL_MAX_CONCURRENT_EXECUTION --- changelog/+align-infrahubctl-env-vars.md | 1 + infrahub_sdk/ctl/cli_commands.py | 8 ++++---- infrahub_sdk/ctl/exporter.py | 4 ++-- infrahub_sdk/ctl/importer.py | 10 ++++++---- 4 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 changelog/+align-infrahubctl-env-vars.md diff --git a/changelog/+align-infrahubctl-env-vars.md b/changelog/+align-infrahubctl-env-vars.md new file mode 100644 index 0000000..8699f94 --- /dev/null +++ b/changelog/+align-infrahubctl-env-vars.md @@ -0,0 +1 @@ +Aligned the environment variables used by the `infrahubctl` with the environment variables used by the SDK diff --git a/infrahub_sdk/ctl/cli_commands.py b/infrahub_sdk/ctl/cli_commands.py index 09a73ec..3cb23a5 100644 --- a/infrahub_sdk/ctl/cli_commands.py +++ b/infrahub_sdk/ctl/cli_commands.py @@ -130,12 +130,12 @@ async def run( debug: bool = False, _: str = CONFIG_PARAM, branch: str = typer.Option("main", help="Branch on which to run the script."), - concurrent: int = typer.Option( - 4, + concurrent: int | None = typer.Option( + None, help="Maximum number of requests to execute at the same time.", - envvar="INFRAHUBCTL_CONCURRENT_EXECUTION", + envvar="INFRAHUB_MAX_CONCURRENT_EXECUTION", ), - timeout: int = typer.Option(60, help="Timeout in sec", envvar="INFRAHUBCTL_TIMEOUT"), + timeout: int = typer.Option(60, help="Timeout in sec", envvar="INFRAHUB_TIMEOUT"), variables: list[str] | None = typer.Argument( None, help="Variables to pass along with the query. Format key=value key=value." ), diff --git a/infrahub_sdk/ctl/exporter.py b/infrahub_sdk/ctl/exporter.py index 8b5a6bc..50be328 100644 --- a/infrahub_sdk/ctl/exporter.py +++ b/infrahub_sdk/ctl/exporter.py @@ -26,9 +26,9 @@ def dump( concurrent: int = typer.Option( 4, help="Maximum number of requests to execute at the same time.", - envvar="INFRAHUBCTL_CONCURRENT_EXECUTION", + envvar="INFRAHUB_MAX_CONCURRENT_EXECUTION", ), - timeout: int = typer.Option(60, help="Timeout in sec", envvar="INFRAHUBCTL_TIMEOUT"), + timeout: int = typer.Option(60, help="Timeout in sec", envvar="INFRAHUB_TIMEOUT"), exclude: list[str] = typer.Option( ["CoreAccount"], help="Prevent node kind(s) from being exported, CoreAccount is excluded by default", diff --git a/infrahub_sdk/ctl/importer.py b/infrahub_sdk/ctl/importer.py index 91d1e74..be08736 100644 --- a/infrahub_sdk/ctl/importer.py +++ b/infrahub_sdk/ctl/importer.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from asyncio import run as aiorun from pathlib import Path @@ -24,12 +26,12 @@ def load( quiet: bool = typer.Option(False, help="No console output"), _: str = CONFIG_PARAM, branch: str = typer.Option("main", help="Branch from which to export"), - concurrent: int = typer.Option( - 4, + concurrent: int | None = typer.Option( + None, help="Maximum number of requests to execute at the same time.", - envvar="INFRAHUBCTL_CONCURRENT_EXECUTION", + envvar="INFRAHUB_MAX_CONCURRENT_EXECUTION", ), - timeout: int = typer.Option(60, help="Timeout in sec", envvar="INFRAHUBCTL_TIMEOUT"), + timeout: int = typer.Option(60, help="Timeout in sec", envvar="INFRAHUB_TIMEOUT"), ) -> None: """Import nodes and their relationships into the database.""" console = Console()