diff --git a/changelog/133.fixed.md b/changelog/133.fixed.md new file mode 100644 index 00000000..401c6e2e --- /dev/null +++ b/changelog/133.fixed.md @@ -0,0 +1 @@ +Fixes issues where InfrahubClient was not properly configured for a branch when running the `infrahubctl transform`, `infrahubctl check` and `infrhubctl generator` commands. diff --git a/infrahub_sdk/ctl/check.py b/infrahub_sdk/ctl/check.py index 99c547fe..d2eacd83 100644 --- a/infrahub_sdk/ctl/check.py +++ b/infrahub_sdk/ctl/check.py @@ -196,7 +196,7 @@ async def run_checks( log = logging.getLogger("infrahub") check_summary: list[bool] = [] - client = initialize_client() + client = initialize_client(branch=branch) for check_module in check_modules: if check_module.definition.targets: result = await run_targeted_check( diff --git a/infrahub_sdk/ctl/cli_commands.py b/infrahub_sdk/ctl/cli_commands.py index 324ba6ab..fd29f31b 100644 --- a/infrahub_sdk/ctl/cli_commands.py +++ b/infrahub_sdk/ctl/cli_commands.py @@ -335,7 +335,7 @@ def transform( transform_config = matched[0] # Get client - client = initialize_client() + client = initialize_client(branch=branch) # Get python transform class instance try: diff --git a/infrahub_sdk/ctl/generator.py b/infrahub_sdk/ctl/generator.py index 26fd6db0..ae588bb2 100644 --- a/infrahub_sdk/ctl/generator.py +++ b/infrahub_sdk/ctl/generator.py @@ -43,7 +43,7 @@ async def run( if param_key: identifier = param_key[0] - client = initialize_client() + client = initialize_client(branch=branch) if variables_dict: data = execute_graphql_query( query=generator_config.query,