Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/374.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix branch creation with the sync client while setting `wait_until_completion=False`
5 changes: 3 additions & 2 deletions infrahub_sdk/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,14 @@ def create(
},
}

query = Mutation(mutation="BranchCreate", input_data=input_data, query=MUTATION_QUERY_DATA)
mutation_query = MUTATION_QUERY_TASK if background_execution else MUTATION_QUERY_DATA
query = Mutation(mutation="BranchCreate", input_data=input_data, query=mutation_query)
response = self.client.execute_graphql(query=query.render(), tracker="mutation-branch-create")

# Make sure server version is recent enough to support background execution, as previously
# using background_execution=True had no effect.
if background_execution and "task" in response["BranchCreate"]:
return BranchData(**response["BranchCreate"]["task"]["id"])
return response["BranchCreate"]["task"]["id"]
return BranchData(**response["BranchCreate"]["object"])

def delete(self, branch_name: str) -> bool:
Expand Down