opsmill / infrahub-sdk-python

Python SDK to interact with Infrahub
https://www.opsmill.com
Apache License 2.0
3 stars 2 forks source link

bug: cannot null optional attributes #98

Open fatih-acar opened 1 month ago

fatih-acar commented 1 month ago

Component

Python SDK

Infrahub SDK version

0.14.0

Current Behavior

Updating a node with optional attributes set to null values using None does not work as expected. The node seems to be seen as unchanged.

Expected Behavior

We should be able to null optional attributes through the SDK.

Steps to Reproduce

Using the following schema:

---
version: '1.0'
nodes:
  - name: Organization
    namespace: Cloud
    attributes:
      - name: orchestrator_endpoint
        kind: URL
        optional: true
      - name: orchestrator_access_token
        kind: Password
        optional: true

Using the following snippet:

                user_org = await client.get(
                    kind="CloudOrganization",
                    ids=str(org.id),
                    deleted_at__isnull=True,
                )

                user_org.orchestrator_endpoint.value = None  # FIXME
                user_org.orchestrator_access_token.value = None  # FIXME
                await user_org.save()

Additional Information

No response