chore: Cleanup warnings and unused functions
All checks were successful
Run Check Script / check (pull_request) Successful in 1m20s
All checks were successful
Run Check Script / check (pull_request) Successful in 1m20s
This commit is contained in:
parent
a1ab5d40fb
commit
8cc7adf196
@ -1,7 +1,4 @@
|
|||||||
use std::{
|
use std::{net::IpAddr, sync::Arc};
|
||||||
net::IpAddr,
|
|
||||||
sync::Arc,
|
|
||||||
};
|
|
||||||
|
|
||||||
use cidr::Ipv4Cidr;
|
use cidr::Ipv4Cidr;
|
||||||
use harmony::{
|
use harmony::{
|
||||||
|
@ -185,7 +185,10 @@ impl K8sClient {
|
|||||||
if let Some(s) = status.status {
|
if let Some(s) = status.status {
|
||||||
let mut stdout_buf = String::new();
|
let mut stdout_buf = String::new();
|
||||||
if let Some(mut stdout) = process.stdout().take() {
|
if let Some(mut stdout) = process.stdout().take() {
|
||||||
stdout.read_to_string(&mut stdout_buf).await;
|
stdout
|
||||||
|
.read_to_string(&mut stdout_buf)
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Failed to get status stdout {e}"))?;
|
||||||
}
|
}
|
||||||
debug!("Status: {} - {:?}", s, status.details);
|
debug!("Status: {} - {:?}", s, status.details);
|
||||||
if s == "Success" {
|
if s == "Success" {
|
||||||
|
@ -37,18 +37,6 @@ pub struct NtfyInterpret {
|
|||||||
pub score: NtfyScore,
|
pub score: NtfyScore,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, EnumString, Display)]
|
|
||||||
enum NtfyAccessMode {
|
|
||||||
#[strum(serialize = "read-write", serialize = "rw")]
|
|
||||||
ReadWrite,
|
|
||||||
#[strum(serialize = "read-only", serialize = "ro", serialize = "read")]
|
|
||||||
ReadOnly,
|
|
||||||
#[strum(serialize = "write-only", serialize = "wo", serialize = "write")]
|
|
||||||
WriteOnly,
|
|
||||||
#[strum(serialize = "deny", serialize = "none")]
|
|
||||||
Deny,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, EnumString, Display)]
|
#[derive(Debug, EnumString, Display)]
|
||||||
enum NtfyRole {
|
enum NtfyRole {
|
||||||
#[strum(serialize = "user")]
|
#[strum(serialize = "user")]
|
||||||
|
@ -126,6 +126,7 @@ impl SecretManager {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
#[cfg(secrete2etest)]
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -70,7 +70,6 @@ mod tests {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_set_and_get_raw_successfully() {
|
async fn test_set_and_get_raw_successfully() {
|
||||||
let dir = tempdir().unwrap();
|
let dir = tempdir().unwrap();
|
||||||
let store = LocalFileSecretStore::default();
|
|
||||||
let ns = "test-ns";
|
let ns = "test-ns";
|
||||||
let key = "test-key";
|
let key = "test-key";
|
||||||
let value = b"{\"data\":\"test-value\"}";
|
let value = b"{\"data\":\"test-value\"}";
|
||||||
|
@ -43,27 +43,27 @@ impl Config {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dhcp_legacy_isc(&mut self) -> DhcpConfigLegacyISC {
|
pub fn dhcp_legacy_isc(&mut self) -> DhcpConfigLegacyISC<'_> {
|
||||||
DhcpConfigLegacyISC::new(&mut self.opnsense, self.shell.clone())
|
DhcpConfigLegacyISC::new(&mut self.opnsense, self.shell.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dhcp(&mut self) -> DhcpConfigDnsMasq {
|
pub fn dhcp(&mut self) -> DhcpConfigDnsMasq<'_> {
|
||||||
DhcpConfigDnsMasq::new(&mut self.opnsense, self.shell.clone())
|
DhcpConfigDnsMasq::new(&mut self.opnsense, self.shell.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dns(&mut self) -> DnsConfig {
|
pub fn dns(&mut self) -> DnsConfig<'_> {
|
||||||
DnsConfig::new(&mut self.opnsense)
|
DnsConfig::new(&mut self.opnsense)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tftp(&mut self) -> TftpConfig {
|
pub fn tftp(&mut self) -> TftpConfig<'_> {
|
||||||
TftpConfig::new(&mut self.opnsense, self.shell.clone())
|
TftpConfig::new(&mut self.opnsense, self.shell.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn caddy(&mut self) -> CaddyConfig {
|
pub fn caddy(&mut self) -> CaddyConfig<'_> {
|
||||||
CaddyConfig::new(&mut self.opnsense, self.shell.clone())
|
CaddyConfig::new(&mut self.opnsense, self.shell.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_balancer(&mut self) -> LoadBalancerConfig {
|
pub fn load_balancer(&mut self) -> LoadBalancerConfig<'_> {
|
||||||
LoadBalancerConfig::new(&mut self.opnsense, self.shell.clone())
|
LoadBalancerConfig::new(&mut self.opnsense, self.shell.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
// dnsmasq.rs
|
// dnsmasq.rs
|
||||||
use crate::modules::dhcp::DhcpError;
|
use crate::modules::dhcp::DhcpError;
|
||||||
use log::{debug, info};
|
use log::{debug, info};
|
||||||
use opnsense_config_xml::dnsmasq::{DhcpBoot, DhcpOptions, DnsMasq};
|
|
||||||
use opnsense_config_xml::{MaybeString, StaticMap};
|
use opnsense_config_xml::{MaybeString, StaticMap};
|
||||||
use std::net::Ipv4Addr;
|
use std::net::Ipv4Addr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
use opnsense_config_xml::OPNsense;
|
use opnsense_config_xml::OPNsense;
|
||||||
|
|
||||||
@ -49,13 +47,6 @@ impl<'a> DhcpConfigDnsMasq<'a> {
|
|||||||
.1
|
.1
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dnsmasq(&mut self) -> &mut DnsMasq {
|
|
||||||
self.opnsense
|
|
||||||
.dnsmasq
|
|
||||||
.as_mut()
|
|
||||||
.expect("Dnsmasq config should exist. Maybe it is not installed yet")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Adds a new static DHCP mapping.
|
/// Adds a new static DHCP mapping.
|
||||||
/// Validates the MAC address and checks for existing mappings to prevent conflicts.
|
/// Validates the MAC address and checks for existing mappings to prevent conflicts.
|
||||||
pub fn add_static_mapping(
|
pub fn add_static_mapping(
|
||||||
|
Loading…
Reference in New Issue
Block a user