mirror of
https://codeberg.org/spire/dispenser.git
synced 2026-06-03 10:04:07 +02:00
timeout for disabling unattended upgrades
This commit is contained in:
parent
f8c594ceb9
commit
d97a00065f
1 changed files with 12 additions and 4 deletions
16
src/main.rs
16
src/main.rs
|
|
@ -16,7 +16,7 @@ use std::sync::Arc;
|
|||
use std::time::{Duration, Instant};
|
||||
use thiserror::Error;
|
||||
use tokio::signal::ctrl_c;
|
||||
use tokio::time::sleep;
|
||||
use tokio::time::{sleep, timeout};
|
||||
use tokio::{select, spawn};
|
||||
use tracing::{debug, error, info, instrument, warn};
|
||||
|
||||
|
|
@ -142,9 +142,17 @@ async fn setup(
|
|||
.await?;
|
||||
|
||||
info!("disabling unattended upgrades");
|
||||
ssh.exec("systemctl disable --now unattended-upgrades")
|
||||
.await?;
|
||||
ssh.exec("apt-get purge unattended-upgrades").await?;
|
||||
if timeout(Duration::from_secs(5), async {
|
||||
let _ = ssh
|
||||
.exec("systemctl disable --now unattended-upgrades")
|
||||
.await;
|
||||
let _ = ssh.exec("apt-get purge unattended-upgrades").await;
|
||||
})
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
error!("Timed out while disabling unattended upgrades");
|
||||
}
|
||||
|
||||
info!("setting up prometheus");
|
||||
ssh.exec("wget https://github.com/icewind1991/palantir/raw/main/palantir.service -O /etc/systemd/system/palantir.service").await?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue