diff --git a/agent/src/client.rs b/agent/src/client.rs index dbb9f3c..1a09945 100644 --- a/agent/src/client.rs +++ b/agent/src/client.rs @@ -5,6 +5,7 @@ use std::collections::HashMap; use uuid::Uuid; #[derive(Debug, Deserialize, Clone)] +#[allow(dead_code)] pub struct AssignedVolume { pub id: String, pub name: String, @@ -57,6 +58,7 @@ pub struct ContainerStatus { } #[derive(Debug, Deserialize)] +#[allow(dead_code)] pub struct AssignedWorkload { pub id: String, pub name: String, @@ -95,6 +97,7 @@ impl ApiClient { self } + #[allow(clippy::too_many_arguments)] pub async fn register( &self, token: &str, diff --git a/agent/src/docker.rs b/agent/src/docker.rs index d8af7da..0a1e937 100644 --- a/agent/src/docker.rs +++ b/agent/src/docker.rs @@ -16,6 +16,7 @@ pub struct PortMapping { } #[derive(Debug, Clone)] +#[allow(dead_code)] pub struct WorkloadSpec { pub workload_id: String, pub name: String, @@ -130,22 +131,9 @@ impl DockerManager { Ok(container.id) } - pub async fn stop_container(&self, container_id: &str) -> Result<()> { - self.docker - .stop_container(container_id, None) - .await - .context("Failed to stop container")?; - - self.docker - .remove_container(container_id, None) - .await - .context("Failed to remove container")?; - - info!(container_id = %container_id, "Container stopped and removed"); - Ok(()) - } } +#[allow(clippy::type_complexity)] fn build_port_config( ports: Option<&[PortMapping]>, ) -> ( diff --git a/agent/src/pki.rs b/agent/src/pki.rs index 227246e..6276822 100644 --- a/agent/src/pki.rs +++ b/agent/src/pki.rs @@ -8,20 +8,17 @@ const CERT_FILE: &str = "/var/lib/csf-daemon/agent.crt"; const CA_FILE: &str = "/var/lib/csf-daemon/ca.crt"; pub struct AgentPki { - key_pem: String, csr_pem: String, } impl AgentPki { pub fn load_or_generate() -> Result { if Path::new(KEY_FILE).exists() && Path::new(CSR_FILE).exists() { - let key_pem = std::fs::read_to_string(KEY_FILE) - .context("Failed to read agent key")?; let csr_pem = std::fs::read_to_string(CSR_FILE) .context("Failed to read agent CSR")?; tracing::info!("PKI: loaded existing keypair and CSR"); - return Ok(Self { key_pem, csr_pem }); + return Ok(Self { csr_pem }); } Self::generate() @@ -47,17 +44,13 @@ impl AgentPki { tracing::info!("PKI: generated new ECDSA keypair and CSR"); - Ok(Self { key_pem, csr_pem }) + Ok(Self { csr_pem }) } pub fn csr_pem(&self) -> &str { &self.csr_pem } - pub fn key_pem(&self) -> &str { - &self.key_pem - } - pub fn has_certificate() -> bool { Path::new(CERT_FILE).exists() && Path::new(CA_FILE).exists() } @@ -73,13 +66,6 @@ impl AgentPki { std::fs::read_to_string(CERT_FILE).context("Failed to read agent certificate") } - pub fn load_ca_pem() -> Result { - std::fs::read_to_string(CA_FILE).context("Failed to read CA certificate") - } - - pub fn load_key_pem() -> Result { - std::fs::read_to_string(KEY_FILE).context("Failed to read agent key") - } } #[cfg(unix)] diff --git a/agent/src/rbd.rs b/agent/src/rbd.rs index 70fda46..3034aea 100644 --- a/agent/src/rbd.rs +++ b/agent/src/rbd.rs @@ -67,24 +67,6 @@ pub async fn mount(device: &str, mount_point: &str) -> Result<()> { Ok(()) } -pub async fn umount(mount_point: &str) -> Result<()> { - info!(mount_point = %mount_point, "Unmounting device"); - - let output = Command::new("umount") - .arg(mount_point) - .output() - .await - .context("Failed to execute umount")?; - - if !output.status.success() { - let stderr = String::from_utf8_lossy(&output.stderr); - warn!(mount_point = %mount_point, error = %stderr, "umount failed"); - return Err(anyhow!("umount failed: {}", stderr)); - } - - info!(mount_point = %mount_point, "Device unmounted"); - Ok(()) -} pub fn mount_point_for(volume_id: &str) -> String { format!("/mnt/csf-volumes/{}", volume_id) diff --git a/control-plane/api-gateway/src/routes/registry.rs b/control-plane/api-gateway/src/routes/registry.rs index 4cb0573..a04b559 100644 --- a/control-plane/api-gateway/src/routes/registry.rs +++ b/control-plane/api-gateway/src/routes/registry.rs @@ -280,8 +280,6 @@ pub async fn delete_pending_agent( } } -/// Create token (Admin only) - DEPRECATED -#[deprecated(note = "Use pre_register_agent instead")] #[utoipa::path( post, path = "/registry/admin/tokens", diff --git a/control-plane/failover-controller/src/metrics.rs b/control-plane/failover-controller/src/metrics.rs index 3c7cf5a..f45d2f6 100644 --- a/control-plane/failover-controller/src/metrics.rs +++ b/control-plane/failover-controller/src/metrics.rs @@ -25,18 +25,6 @@ pub fn init() { }); } -pub fn record_request(method: &str, path: &str, status: u16, duration_secs: f64) { - if let Some(counter) = HTTP_REQUESTS_TOTAL.get() { - counter - .with_label_values(&[method, path, &status.to_string()]) - .inc(); - } - if let Some(histogram) = HTTP_REQUEST_DURATION_SECONDS.get() { - histogram - .with_label_values(&[method, path]) - .observe(duration_secs); - } -} pub async fn metrics_handler() -> impl IntoResponse { let encoder = TextEncoder::new(); diff --git a/control-plane/registry/src/db/agents.rs b/control-plane/registry/src/db/agents.rs index 14bbccc..56af120 100644 --- a/control-plane/registry/src/db/agents.rs +++ b/control-plane/registry/src/db/agents.rs @@ -5,6 +5,7 @@ use sea_orm::{ }; use uuid::Uuid; +#[allow(clippy::too_many_arguments)] pub async fn create( db: &DatabaseConnection, id: Uuid, diff --git a/control-plane/registry/src/db/certificates.rs b/control-plane/registry/src/db/certificates.rs index 46a5008..7c8b3f9 100644 --- a/control-plane/registry/src/db/certificates.rs +++ b/control-plane/registry/src/db/certificates.rs @@ -38,19 +38,6 @@ pub async fn get_active_certificate( .await?) } -pub async fn deactivate_certificates(db: &DatabaseConnection, agent_id: Uuid) -> Result { - let result = agent_certificates::Entity::update_many() - .col_expr( - agent_certificates::Column::IsActive, - sea_orm::sea_query::Expr::value(false), - ) - .filter(agent_certificates::Column::AgentId.eq(agent_id)) - .filter(agent_certificates::Column::IsActive.eq(true)) - .exec(db) - .await?; - - Ok(result.rows_affected) -} pub async fn revoke_certificate( db: &DatabaseConnection, diff --git a/control-plane/registry/src/db/tokens.rs b/control-plane/registry/src/db/tokens.rs index d855b48..ce8f950 100644 --- a/control-plane/registry/src/db/tokens.rs +++ b/control-plane/registry/src/db/tokens.rs @@ -5,6 +5,7 @@ use sea_orm::{ }; use uuid::Uuid; +#[allow(clippy::too_many_arguments)] pub async fn create( db: &DatabaseConnection, agent_id: Uuid, diff --git a/control-plane/registry/src/metrics.rs b/control-plane/registry/src/metrics.rs index 3c7cf5a..f45d2f6 100644 --- a/control-plane/registry/src/metrics.rs +++ b/control-plane/registry/src/metrics.rs @@ -25,18 +25,6 @@ pub fn init() { }); } -pub fn record_request(method: &str, path: &str, status: u16, duration_secs: f64) { - if let Some(counter) = HTTP_REQUESTS_TOTAL.get() { - counter - .with_label_values(&[method, path, &status.to_string()]) - .inc(); - } - if let Some(histogram) = HTTP_REQUEST_DURATION_SECONDS.get() { - histogram - .with_label_values(&[method, path]) - .observe(duration_secs); - } -} pub async fn metrics_handler() -> impl IntoResponse { let encoder = TextEncoder::new(); diff --git a/control-plane/scheduler/src/db/workloads.rs b/control-plane/scheduler/src/db/workloads.rs index 584dc0c..edc6f0f 100644 --- a/control-plane/scheduler/src/db/workloads.rs +++ b/control-plane/scheduler/src/db/workloads.rs @@ -33,6 +33,7 @@ pub async fn create( assigned_agent_id: Set(None), container_id: Set(None), created_by: Set(None), + organization_id: Set(None), created_at: Set(Utc::now().naive_utc()), updated_at: Set(None), }; diff --git a/control-plane/sdn-controller/src/db/networks.rs b/control-plane/sdn-controller/src/db/networks.rs index be803ee..722d9f9 100644 --- a/control-plane/sdn-controller/src/db/networks.rs +++ b/control-plane/sdn-controller/src/db/networks.rs @@ -19,6 +19,7 @@ pub async fn create_network( cidr: Set(req.cidr), overlay_type: Set(req.overlay_type), status: Set("active".to_string()), + organization_id: Set(None), created_at: Set(Utc::now().naive_utc()), updated_at: Set(None), }; diff --git a/control-plane/shared/migration/src/m20251215_180000_add_rbac_tables.rs b/control-plane/shared/migration/src/m20251215_180000_add_rbac_tables.rs index 25e6e20..97ae153 100644 --- a/control-plane/shared/migration/src/m20251215_180000_add_rbac_tables.rs +++ b/control-plane/shared/migration/src/m20251215_180000_add_rbac_tables.rs @@ -174,6 +174,7 @@ enum Organization { } #[derive(DeriveIden)] +#[allow(clippy::enum_variant_names)] enum Role { Table, Id, diff --git a/control-plane/shared/shared/src/db.rs b/control-plane/shared/shared/src/db.rs index f2f2de0..2ecf5d4 100644 --- a/control-plane/shared/shared/src/db.rs +++ b/control-plane/shared/shared/src/db.rs @@ -27,11 +27,6 @@ pub async fn establish_connection() -> Result { #[cfg(test)] mod tests { - use super::*; - #[test] - fn test_db_url_required() { - // This would panic if DATABASE_URL is not set - // In real tests, you'd mock the environment - } + fn test_db_url_required() {} } diff --git a/control-plane/volume-manager/src/ceph/core/mod.rs b/control-plane/volume-manager/src/ceph/core/mod.rs index 3fcb51a..614cd95 100644 --- a/control-plane/volume-manager/src/ceph/core/mod.rs +++ b/control-plane/volume-manager/src/ceph/core/mod.rs @@ -4,4 +4,3 @@ pub mod error; pub use client::CephClient; pub use config::CephConfig; -pub use error::{CephError, Result}; diff --git a/control-plane/volume-manager/src/ceph/ops/mod.rs b/control-plane/volume-manager/src/ceph/ops/mod.rs index 14f353d..7314f87 100644 --- a/control-plane/volume-manager/src/ceph/ops/mod.rs +++ b/control-plane/volume-manager/src/ceph/ops/mod.rs @@ -1,3 +1,3 @@ pub mod init; -pub use init::{create_postgres_volumes, init_ceph, CephManager}; +pub use init::{init_ceph, CephManager}; diff --git a/control-plane/volume-manager/src/db/volumes.rs b/control-plane/volume-manager/src/db/volumes.rs index 8ccd445..59592cf 100644 --- a/control-plane/volume-manager/src/db/volumes.rs +++ b/control-plane/volume-manager/src/db/volumes.rs @@ -27,6 +27,7 @@ pub async fn create( attached_to_agent: Set(None), attached_to_workload: Set(None), mapped_device: Set(None), + organization_id: Set(None), created_at: Set(Utc::now().naive_utc()), updated_at: Set(None), }; diff --git a/control-plane/volume-manager/src/etcd/ha/leader_election.rs b/control-plane/volume-manager/src/etcd/ha/leader_election.rs index f424074..47d9789 100644 --- a/control-plane/volume-manager/src/etcd/ha/leader_election.rs +++ b/control-plane/volume-manager/src/etcd/ha/leader_election.rs @@ -184,7 +184,7 @@ impl LeaderElection { } /// Wartet auf Leadership Changes (Watch) - pub async fn watch_leadership(&self, callback: F) -> Result<(), EtcdError> + pub async fn watch_leadership(&self, _callback: F) -> Result<(), EtcdError> where F: FnMut(Option) + Send + 'static, { diff --git a/control-plane/volume-manager/src/etcd/ha/mod.rs b/control-plane/volume-manager/src/etcd/ha/mod.rs index 59d7759..31724a6 100644 --- a/control-plane/volume-manager/src/etcd/ha/mod.rs +++ b/control-plane/volume-manager/src/etcd/ha/mod.rs @@ -3,5 +3,5 @@ pub mod health; pub mod leader_election; -pub use health::{HealthChecker, NodeHealthStatus}; +pub use health::HealthChecker; pub use leader_election::LeaderElection; diff --git a/control-plane/volume-manager/src/etcd/sync/watcher.rs b/control-plane/volume-manager/src/etcd/sync/watcher.rs index 05606bf..46116a9 100644 --- a/control-plane/volume-manager/src/etcd/sync/watcher.rs +++ b/control-plane/volume-manager/src/etcd/sync/watcher.rs @@ -13,7 +13,7 @@ impl StateWatcher { } /// Beobachtet einen Key-Prefix für Änderungen - pub async fn watch_prefix(&self, prefix: &str, callback: F) -> Result<(), EtcdError> + pub async fn watch_prefix(&self, prefix: &str, _callback: F) -> Result<(), EtcdError> where F: FnMut(WatchEvent) + Send + 'static, { @@ -31,7 +31,7 @@ impl StateWatcher { } /// Beobachtet einen spezifischen Key - pub async fn watch_key(&self, key: &str, callback: F) -> Result<(), EtcdError> + pub async fn watch_key(&self, key: &str, _callback: F) -> Result<(), EtcdError> where F: FnMut(WatchEvent) + Send + 'static, { diff --git a/control-plane/volume-manager/src/patroni/mod.rs b/control-plane/volume-manager/src/patroni/mod.rs index 665b95a..04d0e07 100644 --- a/control-plane/volume-manager/src/patroni/mod.rs +++ b/control-plane/volume-manager/src/patroni/mod.rs @@ -2,5 +2,3 @@ pub mod client; pub mod monitor; pub mod types; -pub use client::PatroniClient; -pub use monitor::PatroniMonitor;