Fix user-stopped service display and flag timing issues
All checks were successful
Build and Release / build-and-release (push) Successful in 2m10s
All checks were successful
Build and Release / build-and-release (push) Successful in 2m10s
Improve user-stopped service tracking behavior: Service Display Fix: - Services widget now shows actual systemctl status (active/inactive) - Use info.status instead of hardcoded text based on widget_status - User-stopped services correctly display 'inactive' with green OK icon - Prevents misleading 'active' display for stopped services User-Stopped Flag Timing Fix: - Clear user-stopped flag AFTER successful service start, not when command sent - Prevents warnings during service startup transition period - Service remains Status::OK during 'activating' state for user-stopped services - Flag only cleared when systemctl start command actually succeeds - Failed start attempts preserve user-stopped flag Result: Clean service state tracking with accurate display and no false alerts during intentional user operations. Bump version to v0.1.45
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.44"
|
||||
version = "0.1.45"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -288,7 +288,7 @@ impl Agent {
|
||||
|
||||
info!("Executing systemctl {} {} (user action: {})", action_str, service_name, is_user_action);
|
||||
|
||||
// Handle user-stopped service tracking before systemctl execution
|
||||
// Handle user-stopped service tracking before systemctl execution (stop only)
|
||||
match action {
|
||||
ServiceAction::UserStop => {
|
||||
info!("Marking service '{}' as user-stopped", service_name);
|
||||
@@ -299,15 +299,6 @@ impl Agent {
|
||||
UserStoppedServiceTracker::update_global(&self.service_tracker);
|
||||
}
|
||||
}
|
||||
ServiceAction::UserStart => {
|
||||
info!("Clearing user-stopped flag for service '{}'", service_name);
|
||||
if let Err(e) = self.service_tracker.clear_user_stopped(service_name) {
|
||||
error!("Failed to clear user-stopped flag: {}", e);
|
||||
} else {
|
||||
// Sync to global tracker
|
||||
UserStoppedServiceTracker::update_global(&self.service_tracker);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
@@ -323,6 +314,17 @@ impl Agent {
|
||||
if !output.stdout.is_empty() {
|
||||
debug!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
||||
}
|
||||
|
||||
// Clear user-stopped flag AFTER successful start command
|
||||
if matches!(action, ServiceAction::UserStart) {
|
||||
info!("Clearing user-stopped flag for service '{}' after successful start", service_name);
|
||||
if let Err(e) = self.service_tracker.clear_user_stopped(service_name) {
|
||||
error!("Failed to clear user-stopped flag: {}", e);
|
||||
} else {
|
||||
// Sync to global tracker
|
||||
UserStoppedServiceTracker::update_global(&self.service_tracker);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
error!("Service {} {} failed: {}", service_name, action_str, stderr);
|
||||
|
||||
Reference in New Issue
Block a user