Skip to content

Commit

Permalink
Wait for NAOs during pre- and postgame (#1672)
Browse files Browse the repository at this point in the history
* Wait for NAOs during pre- and postgame

* Bump pepsi version

---------

Co-authored-by: Julian Schuler <[email protected]>
  • Loading branch information
julianschuler and julianschuler authored Mar 9, 2025
1 parent 843285b commit 60ec10c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions crates/nao/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ impl Nao {
Self { address }
}

pub async fn ping_until_available(host: Ipv4Addr) -> Self {
loop {
if let Ok(nao) = Self::try_new_with_ping(host).await {
return nao;
}
}
}

pub async fn try_new_with_ping(host: Ipv4Addr) -> Result<Self> {
Self::try_new_with_ping_and_arguments(host, PING_TIMEOUT).await
}
Expand Down
2 changes: 1 addition & 1 deletion tools/pepsi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pepsi"
version = "5.1.0"
version = "5.2.0"
edition.workspace = true
license.workspace = true
homepage.workspace = true
Expand Down
4 changes: 3 additions & 1 deletion tools/pepsi/src/post_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ pub async fn post_game(arguments: Arguments, repository: &Repository) -> Result<
&naos,
"Executing postgame tasks...",
|nao_address, progress_bar| async move {
let nao = Nao::try_new_with_ping(nao_address.ip).await?;
progress_bar.set_message("Pinging NAO...");
let nao = Nao::ping_until_available(nao_address.ip).await;

progress_bar.set_message("Stopping HULK service...");
nao.execute_systemctl(SystemctlAction::Stop, "hulk")
.await
Expand Down
2 changes: 1 addition & 1 deletion tools/pepsi/src/pre_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async fn setup_nao(
repository: &Repository,
) -> Result<()> {
progress.set_message("Pinging NAO...");
let nao = Nao::try_new_with_ping(nao_address.ip).await?;
let nao = Nao::ping_until_available(nao_address.ip).await;

if !arguments.skip_os_check {
progress.set_message("Checking OS version...");
Expand Down

0 comments on commit 60ec10c

Please sign in to comment.