chore: cargo fmt
Some checks failed
Run Check Script / check (pull_request) Failing after 37s

This commit is contained in:
Jean-Gabriel Gill-Couture 2025-08-23 15:48:21 -04:00
parent c805d7e018
commit 6c92dd24f7
10 changed files with 29 additions and 22 deletions

View File

@ -126,7 +126,9 @@ async fn main() {
let tftp_score = TftpScore::new(Url::LocalFolder("./data/watchguard/tftpboot".to_string())); let tftp_score = TftpScore::new(Url::LocalFolder("./data/watchguard/tftpboot".to_string()));
let http_score = StaticFilesHttpScore { let http_score = StaticFilesHttpScore {
folder_to_serve: Some(Url::LocalFolder("./data/watchguard/pxe-http-files".to_string())), folder_to_serve: Some(Url::LocalFolder(
"./data/watchguard/pxe-http-files".to_string(),
)),
files: vec![], files: vec![],
}; };
let ipxe_score = IpxeScore::new(); let ipxe_score = IpxeScore::new();

View File

@ -55,11 +55,16 @@ async fn main() {
gateway_ip, gateway_ip,
harmony_inventory_agent, harmony_inventory_agent,
cluster_pubkey_filename, cluster_pubkey_filename,
}.to_string(), }
.to_string(),
}, },
FileContent { FileContent {
path: FilePath::Relative("fallback.ipxe".to_string()), path: FilePath::Relative("fallback.ipxe".to_string()),
content: FallbackIpxeTpl { gateway_ip, kickstart_filename}.to_string(), content: FallbackIpxeTpl {
gateway_ip,
kickstart_filename,
}
.to_string(),
}, },
], ],
}), }),

View File

@ -1,6 +1,6 @@
mod file;
mod id; mod id;
mod version; mod version;
mod file; pub use file::*;
pub use id::*; pub use id::*;
pub use version::*; pub use version::*;
pub use file::*;

View File

@ -64,7 +64,12 @@ impl<T: Topology + HttpServer> Interpret<T> for StaticFilesHttpInterpret {
Ok(Outcome::success(format!( Ok(Outcome::success(format!(
"Http Server running and serving files from folder {:?} and content for {}", "Http Server running and serving files from folder {:?} and content for {}",
self.score.folder_to_serve, self.score.folder_to_serve,
self.score.files.iter().map(|f| f.path.to_string()).collect::<Vec<String>>().join(",") self.score
.files
.iter()
.map(|f| f.path.to_string())
.collect::<Vec<String>>()
.join(",")
))) )))
} }

View File

@ -48,7 +48,7 @@ pub struct CaddyGeneral {
#[yaserde(rename = "TlsDnsPropagationResolvers")] #[yaserde(rename = "TlsDnsPropagationResolvers")]
pub tls_dns_propagation_resolvers: MaybeString, pub tls_dns_propagation_resolvers: MaybeString,
#[yaserde(rename = "TlsDnsEchDomain")] #[yaserde(rename = "TlsDnsEchDomain")]
pub tls_dns_ech_domain: MaybeString, pub tls_dns_ech_domain: Option<MaybeString>,
pub accesslist: MaybeString, pub accesslist: MaybeString,
#[yaserde(rename = "DisableSuperuser")] #[yaserde(rename = "DisableSuperuser")]
pub disable_superuser: Option<i32>, pub disable_superuser: Option<i32>,

View File

@ -1,9 +1,9 @@
mod caddy; mod caddy;
mod dhcpd; mod dhcpd;
pub mod dnsmasq;
mod haproxy; mod haproxy;
mod interfaces; mod interfaces;
mod opnsense; mod opnsense;
pub mod dnsmasq;
pub use caddy::*; pub use caddy::*;
pub use dhcpd::*; pub use dhcpd::*;
pub use haproxy::*; pub use haproxy::*;

View File

@ -4,7 +4,8 @@ use crate::{
config::{SshConfigManager, SshCredentials, SshOPNSenseShell}, config::{SshConfigManager, SshCredentials, SshOPNSenseShell},
error::Error, error::Error,
modules::{ modules::{
caddy::CaddyConfig, dhcp_legacy::DhcpConfigLegacyISC, dns::DnsConfig, dnsmasq::DhcpConfigDnsMasq, load_balancer::LoadBalancerConfig, tftp::TftpConfig caddy::CaddyConfig, dhcp_legacy::DhcpConfigLegacyISC, dns::DnsConfig,
dnsmasq::DhcpConfigDnsMasq, load_balancer::LoadBalancerConfig, tftp::TftpConfig,
}, },
}; };
use log::{debug, info, trace, warn}; use log::{debug, info, trace, warn};

View File

@ -159,11 +159,7 @@ impl SshOPNSenseShell {
wait_for_completion(&mut channel).await wait_for_completion(&mut channel).await
} }
async fn ensure_remote_dir_exists( async fn ensure_remote_dir_exists(&self, sftp: &SftpSession, path: &str) -> Result<(), Error> {
&self,
sftp: &SftpSession,
path: &str,
) -> Result<(), Error> {
if !sftp.try_exists(path).await? { if !sftp.try_exists(path).await? {
info!("Creating remote directory {path}"); info!("Creating remote directory {path}");
sftp.create_dir(path).await?; sftp.create_dir(path).await?;

View File

@ -187,12 +187,10 @@ dhcp-boot=tag:bios,{bios_filename}{tftp_str}
})?; })?;
info!("Restarting dnsmasq to apply changes"); info!("Restarting dnsmasq to apply changes");
self.opnsense_shell.exec("configctl dnsmasq restart").await self.opnsense_shell
.map_err(|e| { .exec("configctl dnsmasq restart")
DhcpError::Configuration(format!( .await
"Restarting dnsmasq failed : {e}" .map_err(|e| DhcpError::Configuration(format!("Restarting dnsmasq failed : {e}")))?;
))
})?;
Ok(()) Ok(())
} }
} }

View File

@ -1,7 +1,7 @@
pub mod caddy; pub mod caddy;
pub mod dhcp;
pub mod dhcp_legacy; pub mod dhcp_legacy;
pub mod dns; pub mod dns;
pub mod dnsmasq;
pub mod load_balancer; pub mod load_balancer;
pub mod tftp; pub mod tftp;
pub mod dhcp;
pub mod dnsmasq;