This commit is contained in:
2025-04-05 11:05:24 +02:00
parent 749c60e131
commit 8605e08a65
10 changed files with 21 additions and 27 deletions

View File

@@ -4,7 +4,7 @@
use rhai::{Engine, EvalAltResult, Array, Dynamic, Map};
use std::collections::HashMap;
use crate::virt::buildah::{self, BuildahError, Image, Builder, ContentOperations};
use crate::virt::buildah::{BuildahError, Image, Builder, ContentOperations};
use crate::process::CommandResult;
/// Register Buildah module functions with the Rhai engine

View File

@@ -3,7 +3,6 @@
//! This module provides Rhai wrappers for the functions in the Nerdctl module.
use rhai::{Engine, EvalAltResult, Array, Dynamic, Map};
use std::collections::HashMap;
use crate::virt::nerdctl::{self, NerdctlError, Image, Container};
use crate::process::CommandResult;
@@ -51,52 +50,52 @@ pub fn container_from_image(name: &str, image: &str) -> Result<Container, Box<Ev
}
/// Reset the container configuration to defaults while keeping the name and image
pub fn container_reset(mut container: Container) -> Container {
pub fn container_reset(container: Container) -> Container {
container.reset()
}
/// Add a port mapping to a Container
pub fn container_with_port(mut container: Container, port: &str) -> Container {
pub fn container_with_port(container: Container, port: &str) -> Container {
container.with_port(port)
}
/// Add a volume mount to a Container
pub fn container_with_volume(mut container: Container, volume: &str) -> Container {
pub fn container_with_volume(container: Container, volume: &str) -> Container {
container.with_volume(volume)
}
/// Add an environment variable to a Container
pub fn container_with_env(mut container: Container, key: &str, value: &str) -> Container {
pub fn container_with_env(container: Container, key: &str, value: &str) -> Container {
container.with_env(key, value)
}
/// Set the network for a Container
pub fn container_with_network(mut container: Container, network: &str) -> Container {
pub fn container_with_network(container: Container, network: &str) -> Container {
container.with_network(network)
}
/// Add a network alias to a Container
pub fn container_with_network_alias(mut container: Container, alias: &str) -> Container {
pub fn container_with_network_alias(container: Container, alias: &str) -> Container {
container.with_network_alias(alias)
}
/// Set CPU limit for a Container
pub fn container_with_cpu_limit(mut container: Container, cpus: &str) -> Container {
pub fn container_with_cpu_limit(container: Container, cpus: &str) -> Container {
container.with_cpu_limit(cpus)
}
/// Set memory limit for a Container
pub fn container_with_memory_limit(mut container: Container, memory: &str) -> Container {
pub fn container_with_memory_limit(container: Container, memory: &str) -> Container {
container.with_memory_limit(memory)
}
/// Set restart policy for a Container
pub fn container_with_restart_policy(mut container: Container, policy: &str) -> Container {
pub fn container_with_restart_policy(container: Container, policy: &str) -> Container {
container.with_restart_policy(policy)
}
/// Set health check for a Container
pub fn container_with_health_check(mut container: Container, cmd: &str) -> Container {
pub fn container_with_health_check(container: Container, cmd: &str) -> Container {
container.with_health_check(cmd)
}
@@ -145,18 +144,18 @@ pub fn container_with_network_aliases(mut container: Container, aliases: Array)
}
/// Set memory swap limit for a Container
pub fn container_with_memory_swap_limit(mut container: Container, memory_swap: &str) -> Container {
pub fn container_with_memory_swap_limit(container: Container, memory_swap: &str) -> Container {
container.with_memory_swap_limit(memory_swap)
}
/// Set CPU shares for a Container
pub fn container_with_cpu_shares(mut container: Container, shares: &str) -> Container {
pub fn container_with_cpu_shares(container: Container, shares: &str) -> Container {
container.with_cpu_shares(shares)
}
/// Set health check with options for a Container
pub fn container_with_health_check_options(
mut container: Container,
container: Container,
cmd: &str,
interval: Option<&str>,
timeout: Option<&str>,
@@ -169,12 +168,12 @@ pub fn container_with_health_check_options(
}
/// Set snapshotter for a Container
pub fn container_with_snapshotter(mut container: Container, snapshotter: &str) -> Container {
pub fn container_with_snapshotter(container: Container, snapshotter: &str) -> Container {
container.with_snapshotter(snapshotter)
}
/// Set detach mode for a Container
pub fn container_with_detach(mut container: Container, detach: bool) -> Container {
pub fn container_with_detach(container: Container, detach: bool) -> Container {
container.with_detach(detach)
}

View File

@@ -4,7 +4,6 @@
use rhai::{Engine, EvalAltResult, Array, Map, Position};
use std::collections::HashMap;
use std::path::Path;
use crate::text::{
TextReplacer, TextReplacerBuilder,
TemplateBuilder,