How do I check that a branch is done provisioning? #218
Replies: 1 comment
-
OK, after further inspection, jobs have an object_id and object_type field, and those seem to correspond to for example I haven't figured out how to get the integer corresponding to an object_type, needed by So something like: def wait_branch(bname):
branchtype=151
#TODO Why is status mandatory for creation? https://github.com/netboxlabs/netbox-branching/discussions/173
branch = n.plugins.branching.branches.create(name=bname, status='new')
while (status := (job := n.core.jobs.get(object_type=branchtype, object_id=branch.id)).status.value) != 'completed':
time.sleep(1)
print(f"Waiting for provisioning of {bname} to complete") |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
So given that the POST request for creating a branch doesn't actually completely create it, and it has to wait for a background provisioning job to finish - how do you wait until the branch is ready? I haven't noticed if there is a way to connect the branch creation result to it's corresponding jobs.
Beta Was this translation helpful? Give feedback.
All reactions