Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rfc] bundlewrap/node.py: add node_ssh_connect hook #755

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading