diff --git a/harmony-rs/examples/tui/src/main.rs b/harmony-rs/examples/tui/src/main.rs index 660d593..3a683d0 100644 --- a/harmony-rs/examples/tui/src/main.rs +++ b/harmony-rs/examples/tui/src/main.rs @@ -1,15 +1,16 @@ use harmony::{ inventory::Inventory, maestro::Maestro, - modules::dummy::{ErrorScore, PanicScore, SuccessScore}, + modules::{dummy::{ErrorScore, PanicScore, SuccessScore}, k8s::deployment::K8sDeploymentScore}, topology::HAClusterTopology, }; #[tokio::main] async fn main() { - let inventory = Inventory::empty_inventory(); - let topology = HAClusterTopology::dummy(); + let inventory = Inventory::autoload(); + let topology = HAClusterTopology::autoload(); let mut maestro = Maestro::new(inventory, topology); + maestro.register_all(vec![ Box::new(SuccessScore {}), Box::new(ErrorScore {}), diff --git a/harmony-rs/harmony/src/domain/inventory/mod.rs b/harmony-rs/harmony/src/domain/inventory/mod.rs index 329e9db..d566f18 100644 --- a/harmony-rs/harmony/src/domain/inventory/mod.rs +++ b/harmony-rs/harmony/src/domain/inventory/mod.rs @@ -34,7 +34,7 @@ pub struct Inventory { } impl Inventory { - pub fn empty_inventory() -> Self { + pub fn autoload() -> Self { Self { location: Location::test_building(), switch: SwitchGroup::new(), diff --git a/harmony-rs/harmony/src/domain/topology/ha_cluster.rs b/harmony-rs/harmony/src/domain/topology/ha_cluster.rs index 011b882..ba7c063 100644 --- a/harmony-rs/harmony/src/domain/topology/ha_cluster.rs +++ b/harmony-rs/harmony/src/domain/topology/ha_cluster.rs @@ -43,7 +43,7 @@ impl HAClusterTopology { Ok(Arc::new(OpenshiftClient::try_default().await?)) } - pub fn dummy() -> Self { + pub fn autoload() -> Self { let dummy_infra = Arc::new(DummyInfra {}); let dummy_host = LogicalHost { ip: ip!("0.0.0.0"), diff --git a/harmony-rs/harmony/src/modules/dhcp.rs b/harmony-rs/harmony/src/modules/dhcp.rs index 20e67e5..604d624 100644 --- a/harmony-rs/harmony/src/modules/dhcp.rs +++ b/harmony-rs/harmony/src/modules/dhcp.rs @@ -15,9 +15,9 @@ use crate::domain::score::Score; #[derive(Debug, new, Clone)] pub struct DhcpScore { - host_binding: Vec, - next_server: Option, - boot_filename: Option, + pub host_binding: Vec, + pub next_server: Option, + pub boot_filename: Option, } impl Score for DhcpScore { diff --git a/harmony-rs/harmony/src/modules/okd/dhcp.rs b/harmony-rs/harmony/src/modules/okd/dhcp.rs index be33987..c976f8d 100644 --- a/harmony-rs/harmony/src/modules/okd/dhcp.rs +++ b/harmony-rs/harmony/src/modules/okd/dhcp.rs @@ -27,13 +27,13 @@ impl OKDDhcpScore { }) .collect(); Self { - dhcp_score: DhcpScore::new( + // TODO : we should add a tftp server to the topology instead of relying on the + // router address, this is leaking implementation details + dhcp_score: DhcpScore { host_binding, - // TODO : we should add a tftp server to the topology instead of relying on the - // router address, this is leaking implementation details - Some(topology.router.get_gateway()), - Some("bootx64.efi".to_string()), - ), + next_server: Some(topology.router.get_gateway()), + boot_filename: Some("bootx64.efi".to_string()), + }, } } } diff --git a/harmony-rs/opnsense-config-xml/src/data/caddy.rs b/harmony-rs/opnsense-config-xml/src/data/caddy.rs index 47dc8a5..c836d44 100644 --- a/harmony-rs/opnsense-config-xml/src/data/caddy.rs +++ b/harmony-rs/opnsense-config-xml/src/data/caddy.rs @@ -49,7 +49,9 @@ pub struct CaddyGeneral { #[yaserde(rename = "GracePeriod")] pub grace_period: Option, #[yaserde(rename = "HttpVersion")] - pub http_version: MaybeString, + pub http_version: Option, + #[yaserde(rename = "HttpVersions")] + pub http_versions: Option, #[yaserde(rename = "LogCredentials")] pub log_credentials: MaybeString, #[yaserde(rename = "LogAccessPlain")] diff --git a/harmony-rs/opnsense-config/src/config/config.rs b/harmony-rs/opnsense-config/src/config/config.rs index 7250783..3f71d55 100644 --- a/harmony-rs/opnsense-config/src/config/config.rs +++ b/harmony-rs/opnsense-config/src/config/config.rs @@ -105,7 +105,7 @@ impl Config { let is_installed = self.is_package_installed(package_name); debug!("Verifying package installed successfully {is_installed}"); - if !is_installed { + if is_installed { info!("Installation successful for {package_name}"); Ok(()) } else {