Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions juju/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from .client import client, connector
from .client.overrides import Caveat, Macaroon
from .constraints import parse as parse_constraints
from .constraints import parse_storage_constraint
from .controller import Controller, ConnectedController
from .delta import get_entity_class, get_entity_delta
from .errors import JujuAPIError, JujuError, JujuModelConfigError, JujuBackupError
Expand Down Expand Up @@ -2115,7 +2116,7 @@ async def _deploy(self, charm_url, application, series, config,
devices=devices,
dryrun=False,
placement=placement,
storage=storage,
storage={k: parse_storage_constraint(v) for k, v in (storage or dict()).items()},
trust=trust,
base=charm_origin.base,
channel=channel,
Expand Down Expand Up @@ -2150,7 +2151,7 @@ async def _deploy(self, charm_url, application, series, config,
endpoint_bindings=endpoint_bindings,
num_units=num_units,
resources=resources,
storage=storage,
storage={k: parse_storage_constraint(v) for k, v in (storage or dict()).items()},
placement=placement,
devices=devices,
attach_storage=attach_storage,
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/bundle/bundle-with-storage-constraint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: bundle-with-storage-constraint

series: jammy

applications:
postgresql:
charm: postgresql
num_units: 1
channel: 14/stable
storage:
pgdata: lxd,8G
12 changes: 12 additions & 0 deletions tests/integration/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,18 @@ async def test_deploy_invalid_bundle():
await model.deploy(str(bundle_path))


@base.bootstrapped
@pytest.mark.bundle
async def test_deploy_bundle_with_storage_constraint():
bundle_path = INTEGRATION_TEST_DIR / 'bundle' / 'bundle-with-storage-constraint.yaml'

async with base.CleanModel() as model:
await model.deploy(bundle_path)
await wait_for_bundle(model, bundle_path)
storage = await model.list_storage()
assert len(storage) == 1


@base.bootstrapped
async def test_deploy_local_charm():
charm_path = TESTS_DIR / 'charm'
Expand Down