Compare commits
1 Commits
35a459f63c
...
6f88fd00c1
Author | SHA1 | Date | |
---|---|---|---|
6f88fd00c1 |
@ -161,11 +161,7 @@ impl DhcpServer for HAClusterTopology {
|
|||||||
self.dhcp_server.set_pxe_options(options).await
|
self.dhcp_server.set_pxe_options(options).await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn set_dhcp_range(
|
async fn set_dhcp_range(&self, start: &IpAddress, end: &IpAddress) -> Result<(), ExecutorError> {
|
||||||
&self,
|
|
||||||
start: &IpAddress,
|
|
||||||
end: &IpAddress,
|
|
||||||
) -> Result<(), ExecutorError> {
|
|
||||||
self.dhcp_server.set_dhcp_range(start, end).await
|
self.dhcp_server.set_dhcp_range(start, end).await
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,11 +302,7 @@ impl DhcpServer for DummyInfra {
|
|||||||
async fn set_pxe_options(&self, _options: PxeOptions) -> Result<(), ExecutorError> {
|
async fn set_pxe_options(&self, _options: PxeOptions) -> Result<(), ExecutorError> {
|
||||||
unimplemented!("{}", UNIMPLEMENTED_DUMMY_INFRA)
|
unimplemented!("{}", UNIMPLEMENTED_DUMMY_INFRA)
|
||||||
}
|
}
|
||||||
async fn set_dhcp_range(
|
async fn set_dhcp_range(&self, start: &IpAddress, end: &IpAddress) -> Result<(), ExecutorError> {
|
||||||
&self,
|
|
||||||
start: &IpAddress,
|
|
||||||
end: &IpAddress,
|
|
||||||
) -> Result<(), ExecutorError> {
|
|
||||||
unimplemented!("{}", UNIMPLEMENTED_DUMMY_INFRA)
|
unimplemented!("{}", UNIMPLEMENTED_DUMMY_INFRA)
|
||||||
}
|
}
|
||||||
fn get_ip(&self) -> IpAddress {
|
fn get_ip(&self) -> IpAddress {
|
||||||
|
@ -59,8 +59,7 @@ pub trait DhcpServer: Send + Sync + std::fmt::Debug {
|
|||||||
async fn remove_static_mapping(&self, mac: &MacAddress) -> Result<(), ExecutorError>;
|
async fn remove_static_mapping(&self, mac: &MacAddress) -> Result<(), ExecutorError>;
|
||||||
async fn list_static_mappings(&self) -> Vec<(MacAddress, IpAddress)>;
|
async fn list_static_mappings(&self) -> Vec<(MacAddress, IpAddress)>;
|
||||||
async fn set_pxe_options(&self, pxe_options: PxeOptions) -> Result<(), ExecutorError>;
|
async fn set_pxe_options(&self, pxe_options: PxeOptions) -> Result<(), ExecutorError>;
|
||||||
async fn set_dhcp_range(&self, start: &IpAddress, end: &IpAddress)
|
async fn set_dhcp_range(&self, start: &IpAddress, end: &IpAddress) -> Result<(), ExecutorError>;
|
||||||
-> Result<(), ExecutorError>;
|
|
||||||
fn get_ip(&self) -> IpAddress;
|
fn get_ip(&self) -> IpAddress;
|
||||||
fn get_host(&self) -> LogicalHost;
|
fn get_host(&self) -> LogicalHost;
|
||||||
async fn commit_config(&self) -> Result<(), ExecutorError>;
|
async fn commit_config(&self) -> Result<(), ExecutorError>;
|
||||||
|
@ -108,9 +108,7 @@ impl<T: Topology + DhcpServer> Interpret<T> for DhcpInterpret {
|
|||||||
info!("Executing DhcpInterpret on inventory {inventory:?}");
|
info!("Executing DhcpInterpret on inventory {inventory:?}");
|
||||||
|
|
||||||
self.set_pxe_options(inventory, topology).await?;
|
self.set_pxe_options(inventory, topology).await?;
|
||||||
topology
|
topology.set_dhcp_range(&self.score.dhcp_range.0, &self.score.dhcp_range.1).await?;
|
||||||
.set_dhcp_range(&self.score.dhcp_range.0, &self.score.dhcp_range.1)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
DhcpHostBindingScore {
|
DhcpHostBindingScore {
|
||||||
host_binding: self.score.host_binding.clone(),
|
host_binding: self.score.host_binding.clone(),
|
||||||
|
@ -46,6 +46,7 @@ impl<T: Topology> Interpret<T> for DiscoverInventoryAgentInterpret {
|
|||||||
_inventory: &Inventory,
|
_inventory: &Inventory,
|
||||||
_topology: &T,
|
_topology: &T,
|
||||||
) -> Result<Outcome, InterpretError> {
|
) -> Result<Outcome, InterpretError> {
|
||||||
|
|
||||||
match self.score.discovery_timeout {
|
match self.score.discovery_timeout {
|
||||||
Some(timeout) => info!("Discovery agent will wait for {timeout} seconds"),
|
Some(timeout) => info!("Discovery agent will wait for {timeout} seconds"),
|
||||||
None => info!(
|
None => info!(
|
||||||
|
@ -59,7 +59,7 @@ use crate::{
|
|||||||
data::Version,
|
data::Version,
|
||||||
hardware::PhysicalHost,
|
hardware::PhysicalHost,
|
||||||
infra::inventory::InventoryRepositoryFactory,
|
infra::inventory::InventoryRepositoryFactory,
|
||||||
instrumentation::{HarmonyEvent, instrument},
|
instrumentation::{instrument, HarmonyEvent},
|
||||||
interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome},
|
interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome},
|
||||||
inventory::{HostRole, Inventory},
|
inventory::{HostRole, Inventory},
|
||||||
modules::{
|
modules::{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// dnsmasq.rs
|
// dnsmasq.rs
|
||||||
use crate::modules::dhcp::DhcpError;
|
use crate::modules::dhcp::DhcpError;
|
||||||
use log::{debug, info, warn};
|
use log::{debug, info, warn};
|
||||||
use opnsense_config_xml::dnsmasq::{DhcpRange, DnsMasq, DnsmasqHost}; // Assuming DhcpRange is defined in opnsense_config_xml::dnsmasq
|
use opnsense_config_xml::dnsmasq::{DnsMasq, DnsmasqHost, DhcpRange}; // Assuming DhcpRange is defined in opnsense_config_xml::dnsmasq
|
||||||
use opnsense_config_xml::{MaybeString, StaticMap};
|
use opnsense_config_xml::{MaybeString, StaticMap};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::net::Ipv4Addr;
|
use std::net::Ipv4Addr;
|
||||||
@ -230,10 +230,7 @@ impl<'a> DhcpConfigDnsMasq<'a> {
|
|||||||
|
|
||||||
// Assuming DnsMasq has dhcp_ranges: Vec<DhcpRange>
|
// Assuming DnsMasq has dhcp_ranges: Vec<DhcpRange>
|
||||||
// Find existing range for "lan" interface
|
// Find existing range for "lan" interface
|
||||||
if let Some(range) = ranges
|
if let Some(range) = ranges.iter_mut().find(|r| r.interface == Some("lan".to_string())) {
|
||||||
.iter_mut()
|
|
||||||
.find(|r| r.interface == Some("lan".to_string()))
|
|
||||||
{
|
|
||||||
// Update existing range
|
// Update existing range
|
||||||
range.start_addr = Some(start.to_string());
|
range.start_addr = Some(start.to_string());
|
||||||
range.end_addr = Some(end.to_string());
|
range.end_addr = Some(end.to_string());
|
||||||
|
Loading…
Reference in New Issue
Block a user