Skip to content

Commit e58e897

Browse files
style: add type hinting and update docstrings for storage
1 parent c53eb98 commit e58e897

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

juju/bundle.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import base64
1010
from contextlib import closing
1111
from pathlib import Path
12+
from typing import Dict, Optional
1213

1314
import yaml
1415

@@ -555,14 +556,20 @@ class AddApplicationChange(ChangeInfo):
555556
this will be used to scale the application.
556557
:options: holds application options.
557558
:constraints: optional application constraints.
558-
:storage: optional storage constraints.
559+
:storage: optional storage constraints, in the form of `{label: constraint}`.
560+
The label is a string specified by the charm, while the constraint is a string following
561+
`the juju storage constraint directive format <https://juju.is/docs/juju/storage-constraint>`_,
562+
specifying the storage pool, number of volumes, and size of each volume.
559563
:devices: optional devices constraints.
560564
:endpoint_bindings: optional endpoint bindings
561565
:resources: identifies the revision to use for each resource of the
562566
application's charm.
563567
:local_resources: identifies the path to the local resource of the
564568
application's charm.
565569
"""
570+
571+
storage: Optional[Dict[str, str]]
572+
566573
@staticmethod
567574
def method():
568575
"""method returns an associated ID for the Juju API call.
@@ -631,7 +638,11 @@ async def run(self, context):
631638
constraints=self.constraints,
632639
endpoint_bindings=self.endpoint_bindings,
633640
resources=resources,
634-
storage={k: parse_storage_constraint(v) for k, v in (self.storage or dict()).items()},
641+
storage={
642+
label: parse_storage_constraint(constraint)
643+
for label, constraint
644+
in (self.storage or {}).items()
645+
},
635646
channel=self.channel,
636647
devices=self.devices,
637648
num_units=self.num_units,

0 commit comments

Comments
 (0)