Skip to content

Commit 6638c90

Browse files
authored
IHS-127 Fix branch creation with sync client (#527)
1 parent 266fecc commit 6638c90

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

changelog/374.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix branch creation with the sync client while setting `wait_until_completion=False`

infrahub_sdk/branch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,14 @@ def create(
292292
},
293293
}
294294

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

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

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

0 commit comments

Comments
 (0)