File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323
2424import websockets
2525import yaml
26+ from typing_extensions import deprecated
2627
2728from . import jasyncio , provisioner , tag , utils
2829from .annotationhelper import _get_annotations , _set_annotations
@@ -801,13 +802,14 @@ async def connect_current(self):
801802 """
802803 return await self .connect ()
803804
805+ @deprecated ("Model.connect_to() is deprecated and will be removed soon" )
804806 async def connect_to (self , connection ):
805807 conn_params = connection .connect_params ()
806808 await self ._connect_direct (** conn_params )
807809
808810 async def _connect_direct (self , ** kwargs ):
809- if self .info :
810- uuid = self .info .uuid
811+ if self ._info :
812+ uuid = self ._info .uuid
811813 elif "uuid" in kwargs :
812814 uuid = kwargs ["uuid" ]
813815 else :
@@ -1227,6 +1229,9 @@ def info(self) -> ModelInfo:
12271229
12281230 If Model.get_info() has not been called, this will return None.
12291231 """
1232+ if not self .is_connected ():
1233+ raise JujuModelError ("Model is not connected" )
1234+
12301235 assert self ._info is not None
12311236 return self ._info
12321237
You can’t perform that action at this time.
0 commit comments