Skip to content

Commit

Permalink
bundlewrap/node.py: add node_ssh_connect hook
Browse files Browse the repository at this point in the history
  • Loading branch information
martin.wiegand committed Jun 4, 2024
1 parent 6c0c908 commit 1578bc8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bundlewrap/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,12 @@ def log_function(msg):
# has completed on the node before trying to reuse the
# multiplexed connection.
if self._ssh_first_conn_lock.acquire(False):

self.repo.hooks.node_ssh_connect(
self.repo,
self,
)

try:
with io.job(_("{} establishing connection...").format(bold(self.name))):
operations.run(
Expand Down
1 change: 1 addition & 0 deletions bundlewrap/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
'lock_add',
'lock_remove',
'lock_show',
'node_ssh_connect',
'node_apply_end',
'node_apply_start',
'node_run_end',
Expand Down
10 changes: 10 additions & 0 deletions docs/content/repo/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ Called each time a `bw apply` command reaches a new item.

---

**`node_ssh_connect(repo, node, **kwargs)`**

Called before the first ssh connection attempt is made once per node.

`repo` The current repository (instance of `bundlewrap.repo.Repository`).

`node` The current node (instance of `bundlewrap.node.Node`).

---

**`item_apply_end(repo, node, item, duration=None, status_code=None, status_before=None, status_after=None, **kwargs)`**

Called each time a `bw apply` command completes processing an item.
Expand Down

0 comments on commit 1578bc8

Please sign in to comment.