mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
fix(core): preserve plugin URLs across binding updates
BindInfo::update was replacing addresses with a new DerivedAddressInfo that cleared the available set, wiping plugin-exported URLs whenever bind() was called. Also simplify update_addresses plugin preservation to use retain in place rather than collecting into a separate set.
This commit is contained in:
@@ -204,11 +204,7 @@ impl BindInfo {
|
||||
enabled: true,
|
||||
options,
|
||||
net: lan,
|
||||
addresses: DerivedAddressInfo {
|
||||
enabled: addresses.enabled,
|
||||
disabled: addresses.disabled,
|
||||
available: BTreeSet::new(),
|
||||
},
|
||||
addresses,
|
||||
})
|
||||
}
|
||||
pub fn disable(&mut self) {
|
||||
|
||||
@@ -92,15 +92,10 @@ impl Model<Host> {
|
||||
for (_, bind) in this.bindings.as_entries_mut()? {
|
||||
let net = bind.as_net().de()?;
|
||||
let opt = bind.as_options().de()?;
|
||||
|
||||
// Preserve existing plugin-provided addresses across recomputation
|
||||
let plugin_addrs: BTreeSet<HostnameInfo> = bind
|
||||
.as_addresses()
|
||||
.as_available()
|
||||
.de()?
|
||||
.into_iter()
|
||||
.filter(|h| matches!(h.metadata, HostnameMetadata::Plugin { .. }))
|
||||
.collect();
|
||||
let mut available = BTreeSet::new();
|
||||
let mut available = bind.as_addresses().as_available().de()?;
|
||||
available.retain(|h| matches!(h.metadata, HostnameMetadata::Plugin { .. }));
|
||||
for (gid, g) in gateways {
|
||||
let Some(ip_info) = &g.ip_info else {
|
||||
continue;
|
||||
@@ -290,7 +285,6 @@ impl Model<Host> {
|
||||
});
|
||||
}
|
||||
}
|
||||
available.extend(plugin_addrs);
|
||||
bind.as_addresses_mut().as_available_mut().ser(&available)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user