Skip to content

Commit 263fa3e

Browse files
committed
Add some docstrings for bundle code
1 parent 5e7d1eb commit 263fa3e

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

juju/bundle.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,24 @@ def _resolve_include_file_config(self, bundle_dir):
223223

224224
return self.bundle, self.overlays
225225

226-
async def fetch_plan(self, charm_url, origin, overlays=[]):
227-
entity_id = charm_url.path()
228-
is_local = Schema.LOCAL.matches(charm_url.schema)
226+
async def fetch_plan(self, bundle_url, origin, overlays=[]):
227+
"""fetch_plan is called by the model.deploy(). It gathers the information about the
228+
bundle to be deployed (whether local or CharmHub), straightens it up, applies overlays
229+
if any overlays are given. Validates the bundle against known issues. Resolves and adds
230+
local charms if there's any in the bundle. Resolves and adds --include-file configs if
231+
there's any. Finally it calls the BundleFacade.GetChanges() to get the plan for the
232+
bundle to be handed to the execute_plan() by the model.deploy(). Note that it doesn't
233+
return the plan, just saves it in the self (BundleHandler) to be used later.
234+
235+
:param client.URL bundle_url: the url of the bundle to be deployed
236+
:param client.CharmOrigin origin: the origin of the bundle to be deployed
237+
:param [string] overlays: paths for the yaml files containing overlays to be applied to
238+
the bundle during deployment
239+
240+
:returns: None
241+
"""
242+
entity_id = bundle_url.path()
243+
is_local = Schema.LOCAL.matches(bundle_url.schema)
229244
bundle_dir = None
230245

231246
if is_local and os.path.isfile(entity_id):
@@ -235,8 +250,8 @@ async def fetch_plan(self, charm_url, origin, overlays=[]):
235250
bundle_yaml = (Path(entity_id) / "bundle.yaml").read_text()
236251
bundle_dir = Path(entity_id)
237252

238-
if Schema.CHARM_HUB.matches(charm_url.schema):
239-
bundle_yaml = await self._download_bundle(charm_url, origin)
253+
if Schema.CHARM_HUB.matches(bundle_url.schema):
254+
bundle_yaml = await self._download_bundle(bundle_url, origin)
240255

241256
if not bundle_yaml:
242257
raise JujuError('empty bundle, nothing to deploy')

0 commit comments

Comments
 (0)