File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -50,13 +50,11 @@ handled in code separately from `name` being a valid string.
5050A connector that implements execution requires a few more methods:
5151
5252``` py
53- class LocalConnector (BaseConnector ):
53+ class MyConnector (BaseConnector ):
5454 handles_execution = True
5555
5656 @ staticmethod
5757 def make_names_data (_ = None ):
58- # Unlike InventoryConnector above, this connector can only return one host each invocation of make_names_data().
59-
6058 ... # see above
6159
6260 def run_shell_command (
@@ -113,6 +111,19 @@ class LocalConnector(BaseConnector):
113111 Returns:
114112 bool: indicating success or failure.
115113 """
114+
115+
116+ # The following two optional methods can be used to hook into the connect/disconnect steps:
117+ def connect (self ) -> None :
118+ """
119+ Connect this connector instance. Should raise pyinfra.api.exceptions.ConnectError exceptions
120+ to indicate failure.
121+ """
122+
123+ def disconnect (self ) -> None :
124+ """
125+ Disconnect this connector instance, should never fail.
126+ """
116127```
117128
118129## Where to make changes
You can’t perform that action at this time.
0 commit comments