Fix compilation errors from command receiver removal
All checks were successful
Build and Release / build-and-release (push) Successful in 1m8s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m8s
- Remove AgentCommand import from agent.rs - Remove handle_commands() method - Remove command handling from main loop - Remove command_port validation checks
This commit is contained in:
parent
f94ca60e69
commit
e3996fdb84
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.191"
|
version = "0.1.203"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
@ -301,7 +301,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.191"
|
version = "0.1.203"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -324,7 +324,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.191"
|
version = "0.1.203"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use std::time::Duration;
|
|||||||
use tokio::time::interval;
|
use tokio::time::interval;
|
||||||
use tracing::{debug, error, info};
|
use tracing::{debug, error, info};
|
||||||
|
|
||||||
use crate::communication::{AgentCommand, ZmqHandler};
|
use crate::communication::ZmqHandler;
|
||||||
use crate::config::AgentConfig;
|
use crate::config::AgentConfig;
|
||||||
use crate::collectors::{
|
use crate::collectors::{
|
||||||
Collector,
|
Collector,
|
||||||
@ -134,12 +134,6 @@ impl Agent {
|
|||||||
// NOTE: With structured data, we might need to implement status tracking differently
|
// NOTE: With structured data, we might need to implement status tracking differently
|
||||||
// For now, we skip this until status evaluation is migrated
|
// For now, we skip this until status evaluation is migrated
|
||||||
}
|
}
|
||||||
// Handle incoming commands (check periodically)
|
|
||||||
_ = tokio::time::sleep(Duration::from_millis(100)) => {
|
|
||||||
if let Err(e) = self.handle_commands().await {
|
|
||||||
error!("Error handling commands: {}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ = &mut shutdown_rx => {
|
_ = &mut shutdown_rx => {
|
||||||
info!("Shutdown signal received, stopping agent loop");
|
info!("Shutdown signal received, stopping agent loop");
|
||||||
break;
|
break;
|
||||||
@ -259,36 +253,4 @@ impl Agent {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle incoming commands from dashboard
|
|
||||||
async fn handle_commands(&mut self) -> Result<()> {
|
|
||||||
// Try to receive a command (non-blocking)
|
|
||||||
if let Ok(Some(command)) = self.zmq_handler.try_receive_command() {
|
|
||||||
info!("Received command: {:?}", command);
|
|
||||||
|
|
||||||
match command {
|
|
||||||
AgentCommand::CollectNow => {
|
|
||||||
info!("Received immediate collection request");
|
|
||||||
if let Err(e) = self.collect_and_broadcast().await {
|
|
||||||
error!("Failed to collect on demand: {}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AgentCommand::SetInterval { seconds } => {
|
|
||||||
info!("Received interval change request: {}s", seconds);
|
|
||||||
// Note: This would require more complex handling to update the interval
|
|
||||||
// For now, just acknowledge
|
|
||||||
}
|
|
||||||
AgentCommand::ToggleCollector { name, enabled } => {
|
|
||||||
info!("Received collector toggle request: {} -> {}", name, enabled);
|
|
||||||
// Note: This would require more complex handling to enable/disable collectors
|
|
||||||
// For now, just acknowledge
|
|
||||||
}
|
|
||||||
AgentCommand::Ping => {
|
|
||||||
info!("Received ping command");
|
|
||||||
// Maybe send back a pong or status
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -7,14 +7,6 @@ pub fn validate_config(config: &AgentConfig) -> Result<()> {
|
|||||||
bail!("ZMQ publisher port cannot be 0");
|
bail!("ZMQ publisher port cannot be 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.zmq.command_port == 0 {
|
|
||||||
bail!("ZMQ command port cannot be 0");
|
|
||||||
}
|
|
||||||
|
|
||||||
if config.zmq.publisher_port == config.zmq.command_port {
|
|
||||||
bail!("ZMQ publisher and command ports cannot be the same");
|
|
||||||
}
|
|
||||||
|
|
||||||
if config.zmq.bind_address.is_empty() {
|
if config.zmq.bind_address.is_empty() {
|
||||||
bail!("ZMQ bind address cannot be empty");
|
bail!("ZMQ bind address cannot be empty");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user