Open
Description
Component
Python SDK
Infrahub SDK version
1.12.0
Current Behavior
When you change the default_branch
on a SDK client object, it doesn't change the default_branch
of that client's store.
This leads to a situation where an object cannot be retrieved from the store.
from infrahub_sdk import InfrahubClientSync
client = InfrahubClientSync(address="https://demo.infrahub.app")
device = client.get("InfraDevice", name__value="atl1-edge1")
assert client.store.get(device.id) # works, store and client default_branch match
client.branch.create("random")
client.store.get(key=device.id, branch="random") # Raise, expected
client.default_branch = "random"
device2 = client.get("InfraDevice", name__value="atl1-core1")
client.store.get(device2.id) # Raise because the default_branch in the store is main, but the object is store for the random branch
device == client.store.get(device.id) # TRUE! This works because the store default_branch is still main
Expected Behavior
The store default_branch
gets updated whenever we update the SDK's default_branch
.
Steps to Reproduce
from infrahub_sdk import InfrahubClientSync
client = InfrahubClientSync(address="https://demo.infrahub.app")
device = client.get("InfraDevice", name__value="atl1-edge1")
assert client.store.get(device.id) # works, store and client default_branch match
client.branch.create("random")
client.store.get(key=device.id, branch="random") # Raise, expected
client.default_branch = "random"
device2 = client.get("InfraDevice", name__value="atl1-core1")
client.store.get(device2.id) # Raise because the default_branch in the store is main, but the object is store for the random branch
device == client.store.get(device.id) # TRUE! This works because the store default_branch is still main
Additional Information
No response