feat: add discovery
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-11-24 17:12:15 +01:00
parent c4434fd841
commit ee323e99e8
20 changed files with 1482 additions and 117 deletions

View File

@@ -4,21 +4,24 @@ use super::agent_state::AgentState;
#[derive(Clone)]
pub struct AgentRefresh {
_state: AgentState,
host: String,
process_host: String,
}
impl AgentRefresh {
pub fn new(state: impl Into<AgentState>, host: impl Into<String>) -> Self {
pub fn new(state: impl Into<AgentState>) -> Self {
let state: AgentState = state.into();
Self {
_state: state.into(),
host: host.into(),
process_host: state.discovery.process_host.clone(),
}
}
}
#[async_trait::async_trait]
impl notmad::Component for AgentRefresh {
fn name(&self) -> Option<String> {
Some("agent_refresh".into())
}
async fn run(
&self,
cancellation_token: tokio_util::sync::CancellationToken,
@@ -39,7 +42,7 @@ impl notmad::Component for AgentRefresh {
#[async_trait::async_trait]
impl nodrift::Drifter for AgentRefresh {
async fn execute(&self, _token: tokio_util::sync::CancellationToken) -> anyhow::Result<()> {
tracing::info!(host = self.host, "refreshing agent");
tracing::info!(process_host = self.process_host, "refreshing agent");
// Get plan
let plan = Plan::new();