You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> infrahubctl protocols
HTTP communication failure: Client error '400 Bad Request'for url 'http://localhost:8000/api/schema?branch=None'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 on GET to http://localhost:8000/api/schema?branch=None
Expected Behavior
I would expect the command to get the default branch from my environment.
The same way I could do infrahubctl schema load schema.yml without having to specify the branch
Steps to Reproduce
Doesn't work:
infrahubctl protocols
Works:
infrahubctl protocols --branch main
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Looking at this I'd argue that it's also incorrect for infrahubctl schema load schema.yml with regards to the branch being hardcoded to main. Something like this would be more correct. We can perhaps add it for the protocols for now and then review the other commands for the next release.
diff --git a/infrahub_sdk/ctl/cli_commands.py b/infrahub_sdk/ctl/cli_commands.py
index fde4b16..3e4059b 100644
--- a/infrahub_sdk/ctl/cli_commands.py+++ b/infrahub_sdk/ctl/cli_commands.py@@ -366,9 +366,9 @@ def transform(
@app.command(name="protocols")
@catch_exception(console=console)
-def protocols( # noqa: PLR0915+def protocols(
schemas: list[Path] = typer.Option(None, help="List of schemas or directory to load."),
- branch: str = typer.Option(None, help="Branch of schema to export Python protocols for."),+ branch: Optional[str] = typer.Option(None, help="Branch of schema to export Python protocols for."),
sync: bool = typer.Option(False, help="Generate for sync or async."),
_: str = CONFIG_PARAM,
out: str = typer.Option("schema_protocols.py", help="Path to a file to save the result."),
@@ -388,6 +388,7 @@ def protocols( # noqa: PLR0915
else:
client = initialize_client_sync()
+ branch = branch or client.default_branch
Component
infrahubctl
Infrahub SDK version
0.14.1
Current Behavior
Expected Behavior
I would expect the command to get the default branch from my environment.
The same way I could do
infrahubctl schema load schema.yml
without having to specify the branchSteps to Reproduce
Doesn't work:
Works:
Additional Information
No response
The text was updated successfully, but these errors were encountered: