juju / python-libjuju

Python library for the Juju API
Apache License 2.0
57 stars 93 forks source link

Incorrect parsing of storage constraints #1052

Closed luissimas closed 1 month ago

luissimas commented 1 month ago

Description

When deploying a bundle with an application that contains storage constraints the deployment fails with the following message:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Urgency

Annoying bug in our test suite

Python-libjuju version

3.4

Juju version

3.5.0

Reproduce / Test

import asyncio
from juju.model import Model

bundle_file = "./bundle.yaml"

bundle = """
name: sample-bundle

series: jammy

machines:
  "0":
    constraints: instance-type=type1

applications:
  swift-storage:
    charm: swift-storage
    channel: yoga/stable
    num_units: 1
    to:
      - "0"
    storage:
      block-devices: cinder,1,5G
"""

async def main():
    with open(bundle_file, "w") as f:
        f.write(bundle)

    model = Model()
    await model.connect()
    await model.deploy(bundle_file)

asyncio.run(main())