The templates are now stored inside of the proxmox-frr binary because we
use `include_str!`. In pve-network we need to use these templates to
check if they have changed and compare them to the override templates
(in the postinst). We also need the templates for the pvesdn cli so that
the user can create overrides.

Signed-off-by: Gabriel Goller <[email protected]>
---
 pve-rs/src/bindings/sdn/mod.rs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pve-rs/src/bindings/sdn/mod.rs b/pve-rs/src/bindings/sdn/mod.rs
index fde3138d55f7..f5d3ea89e06d 100644
--- a/pve-rs/src/bindings/sdn/mod.rs
+++ b/pve-rs/src/bindings/sdn/mod.rs
@@ -9,6 +9,7 @@ pub mod pve_rs_sdn {
     use anyhow::Error;
     use proxmox_frr::ser::{FrrConfig, serializer::to_raw_config};
 
+    use proxmox_frr::ser;
     use proxmox_ve_config::common::valid::Validatable;
     use proxmox_ve_config::sdn::fabric::section_config::node::NodeId;
 
@@ -26,4 +27,10 @@ pub mod pve_rs_sdn {
         proxmox_ve_config::sdn::fabric::frr::build_fabric(node_id, 
fabric_config, &mut frr_config)?;
         to_raw_config(&frr_config)
     }
+
+    /// Return the FRR template with the passed name.
+    #[export]
+    pub fn get_template(template: &str) -> Option<&'static str> {
+        ser::serializer::TEMPLATES.get(template).copied()
+    }
 }
-- 
2.47.3




Reply via email to