Skip to content

Commit 9ee7b7a

Browse files
authored
Update pod.rs
1 parent a347b77 commit 9ee7b7a

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

source-code/src/pod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fs;
33
use std::path::PathBuf;
44
use serde::{Deserialize, Serialize};
55
use miette::{miette, IntoDiagnostic, Result};
6-
use crate::container::{self, ContainerState, HACKEROS_RUN};
6+
use crate::container::{HACKEROS_RUN};
77
use crate::config::HkConfig;
88

99
#[derive(Serialize, Deserialize, Debug, Clone)]
@@ -74,13 +74,14 @@ pub fn start_pod(name: &str, spec: PodSpec) -> Result<()> {
7474
}
7575

7676
for mut container_cfg in spec.containers {
77-
container_cfg.metadata.name = format!("{}-{}", name, container_cfg.metadata.name);
77+
let container_name = format!("{}-{}", name, container_cfg.metadata.name);
78+
container_cfg.metadata.name = container_name.clone();
7879
if spec.shared_network {
7980
container_cfg.runtime.network_mode = "none".to_string();
8081
}
8182
crate::container::start_container(container_cfg, true)?;
82-
let (_, state) = crate::container::find_container(&container_cfg.metadata.name)?;
83-
container_ids.push(state.id.clone());
83+
let (_, state) = crate::container::find_container(&container_name)?;
84+
container_ids.push(state.id);
8485
}
8586

8687
let pod_state = PodState {

0 commit comments

Comments
 (0)