feat: Add function that applies netmask to ip
Committed / committed (pull_request) Successful in 46s
CI / prek (pull_request) Has been cancelled
CI / cargo shear (pull_request) Has been cancelled

This commit is contained in:
2026-04-21 04:46:31 +02:00
parent 108db75dc9
commit 003b28a841
+9
View File
@@ -16,6 +16,13 @@ pub struct PathEnvironment<'a> {
path: PathBuf,
}
fn apply_netmask(
ip: ViaDeserialize<Ipv4Addr>,
netmask: ViaDeserialize<Ipv4Addr>,
) -> Result<String, minijinja::Error> {
Ok((*ip & *netmask).to_string())
}
impl<'a> PathEnvironment<'a> {
pub fn new(path: &Path) -> Self {
let mut env = Environment::new();
@@ -41,6 +48,8 @@ impl<'a> PathEnvironment<'a> {
}
});
env.add_function("apply_netmask", apply_netmask);
// Helper function for getting the path to kubeconfig files
env.add_filter("kubeconfig", move |names: Vec<String>| {
names