Skip to content

bug: Sync branch creation doesn't correctly handle wait_until_completion #374

@ogenstad

Description

@ogenstad

h3. Component

[| #component]

No response

h3. Infrahub SDK version

[| #infrahub-sdk-version]

v1.11.0

h3. Current Behavior

[| #current-behavior]

An exception is raised when using the wait_until_completion=False parameter on the sync version of client.branch.create.

h3. Expected Behavior

[| #expected-behavior]

Both of these should work:

from infrahub_sdk import InfrahubClient, InfrahubClientSync

client_sync = InfrahubClientSync()
client_sync.branch.create(branch_name="branchA", description="description", sync_with_git=False, wait_until_completion=False)

client = InfrahubClient()
await client.branch.create(branch_name="branchB", description="description", sync_with_git=False, wait_until_completion=False)

h3. Steps to Reproduce

[| #steps-to-reproduce]

When running this using the sync client we get an exception:

>>> from infrahub_sdk import InfrahubClientSync
>>>
>>> client_sync = InfrahubClientSync()
>>> client_sync.branch.create(branch_name="branchA", description="description", sync_with_git=False, wait_until_completion=False)
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/patrick/Code/opsmill/infrahub-sdk-python/infrahub_sdk/branch.py", line 302, in create
    return BranchData(**response["BranchCreate"]["object"])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: infrahub_sdk.branch.BranchData() argument after ** must be a mapping, not NoneType
>>>

h3. Additional Information

[| #additional-information]

No response

Metadata

Metadata

Assignees

Labels

type/bugSomething isn't working as expectedtype/newcomersGood for newcomers

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions