2020
2121from . import provisioner , tag , utils
2222from .annotationhelper import _get_annotations , _set_annotations
23- from .bundle import BundleHandler , get_charm_series
23+ from .bundle import BundleHandler , get_charm_series , is_local_charm
2424from .charmhub import CharmHub
2525from .charmstore import CharmStore
2626from .client import client , connector
@@ -1428,6 +1428,11 @@ async def deploy(
14281428 origin = None
14291429 result = None
14301430
1431+ # Ensure what we pass in, is a string.
1432+ entity_url = str (entity_url )
1433+ if is_local_charm (entity_url ) and not entity_url .startswith ("local:" ):
1434+ entity_url = "local:{}" .format (entity_url )
1435+ print ("!!!" , entity_url )
14311436 url = URL .parse (str (entity_url ))
14321437 architecture = await self ._resolve_architecture (url )
14331438
@@ -1441,6 +1446,7 @@ async def deploy(
14411446 if not (entity_path .is_dir () or entity_path .is_file ()):
14421447 raise JujuError ('{} path not found' .format (entity_url ))
14431448
1449+ is_local = True
14441450 is_bundle = (
14451451 (entity_url .endswith (".yaml" ) and entity_path .exists ()) or
14461452 bundle_path .exists ()
@@ -1475,13 +1481,13 @@ async def deploy(
14751481 raise JujuError ('unknown charm or bundle {}' .format (entity_url ))
14761482
14771483 if not application_name :
1478- if Schema .LOCAL .matches (url .schema ) and Schema .CHARM_STORE .matches (url .schema ):
1479- application_name = result ['Meta' ]['charm-metadata' ]['Name' ]
1480- else :
1484+ if Schema .CHARM_HUB .matches (url .schema ):
14811485 # For charmhub charms, we don't have the metadata and we're not
14821486 # going to get it, so fallback to the url and use that one if a
14831487 # user didn't specify it.
14841488 application_name = url .name
1489+ elif result is not None and not is_bundle :
1490+ application_name = result ['Meta' ]['charm-metadata' ]['Name' ]
14851491
14861492 if is_bundle :
14871493 handler = BundleHandler (self , trusted = trust , forced = force )
0 commit comments