...
This commit is contained in:
		| @@ -1,7 +1,6 @@ | ||||
| use std::process::Command; | ||||
| use std::path::Path; | ||||
| use std::fs; | ||||
| use std::env; | ||||
| use regex::Regex; | ||||
| use std::fmt; | ||||
| use std::error::Error; | ||||
|   | ||||
| @@ -6,7 +6,6 @@ use redis::Cmd; | ||||
| use serde::{Deserialize, Serialize}; | ||||
|  | ||||
| use crate::redisclient; | ||||
| use crate::git::git::parse_git_url; | ||||
|  | ||||
| // Define a custom error type for GitExecutor operations | ||||
| #[derive(Debug)] | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| use regex::Regex; | ||||
| use std::fs; | ||||
| use std::io::{self, Read, Seek, SeekFrom}; | ||||
| use std::io::{self, Read}; | ||||
| use std::path::Path; | ||||
|  | ||||
| /// Represents the type of replacement to perform. | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| // Basic buildah operations for container management | ||||
| use std::process::Command; | ||||
| use crate::process::CommandResult; | ||||
| use super::{BuildahError, Builder}; | ||||
| use super::BuildahError; | ||||
|  | ||||
|  | ||||
| /// Execute a buildah command and return the result | ||||
|   | ||||
| @@ -1,10 +1,9 @@ | ||||
| // File: /root/code/git.ourworld.tf/herocode/sal/src/virt/nerdctl/container.rs | ||||
|  | ||||
| use std::collections::HashMap; | ||||
| use crate::process::CommandResult; | ||||
| use crate::virt::nerdctl::{execute_nerdctl_command, NerdctlError}; | ||||
| use crate::os; | ||||
| use super::container_types::{Container, HealthCheck, ContainerStatus, ResourceUsage}; | ||||
| use super::container_types::Container; | ||||
|  | ||||
| impl Container { | ||||
|     /// Create a new container reference with the given name | ||||
|   | ||||
| @@ -12,7 +12,7 @@ impl Container { | ||||
|     /// # Returns | ||||
|     /// | ||||
|     /// * `Self` - The container instance for method chaining | ||||
|     pub fn reset(mut self) -> Self { | ||||
|     pub fn reset(self) -> Self { | ||||
|         let name = self.name; | ||||
|         let image = self.image.clone(); | ||||
|          | ||||
|   | ||||
| @@ -1,10 +1,9 @@ | ||||
| // File: /root/code/git.ourworld.tf/herocode/sal/src/virt/nerdctl/images.rs | ||||
|  | ||||
| use std::collections::HashMap; | ||||
| use crate::virt::nerdctl::execute_nerdctl_command; | ||||
| use crate::process::CommandResult; | ||||
| use super::NerdctlError; | ||||
| use serde_json::{self, Value}; | ||||
| use serde_json::{self}; | ||||
| use serde::{Deserialize, Serialize}; | ||||
|  | ||||
| /// Represents a container image | ||||
|   | ||||
		Reference in New Issue
	
	Block a user