mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-01 17:06:28 +00:00
image_rpc: replace colon with underline for image store path
':' will have special meaning for umoci during upack, then we do not use it as part of the image store path Signed-off-by: Arron Wang <arron.wang@intel.com>
This commit is contained in:
@@ -405,19 +405,20 @@ impl ImageService {
|
|||||||
env::set_var("OCICRYPT_KEYPROVIDER_CONFIG", OCICRYPT_CONFIG_PATH);
|
env::set_var("OCICRYPT_KEYPROVIDER_CONFIG", OCICRYPT_CONFIG_PATH);
|
||||||
|
|
||||||
let image = req.get_image();
|
let image = req.get_image();
|
||||||
let mut cid = req.get_container_id();
|
let mut cid = req.get_container_id().to_string();
|
||||||
|
|
||||||
let aa_kbc_params = &AGENT_CONFIG.read().await.aa_kbc_params;
|
let aa_kbc_params = &AGENT_CONFIG.read().await.aa_kbc_params;
|
||||||
|
|
||||||
if cid.is_empty() {
|
if cid.is_empty() {
|
||||||
let v: Vec<&str> = image.rsplit('/').collect();
|
let v: Vec<&str> = image.rsplit('/').collect();
|
||||||
if !v[0].is_empty() {
|
if !v[0].is_empty() {
|
||||||
cid = v[0]
|
// ':' have special meaning for umoci during upack
|
||||||
|
cid = v[0].replace(":", "_");
|
||||||
} else {
|
} else {
|
||||||
return Err(anyhow!("Invalid image name. {}", image));
|
return Err(anyhow!("Invalid image name. {}", image));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
verify_cid(cid)?;
|
verify_cid(&cid)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !aa_kbc_params.is_empty() {
|
if !aa_kbc_params.is_empty() {
|
||||||
@@ -439,7 +440,13 @@ impl ImageService {
|
|||||||
let config_policy_path = &AGENT_CONFIG.read().await.container_policy_path;
|
let config_policy_path = &AGENT_CONFIG.read().await.container_policy_path;
|
||||||
let policy_path = (!config_policy_path.is_empty()).then(|| config_policy_path);
|
let policy_path = (!config_policy_path.is_empty()).then(|| config_policy_path);
|
||||||
|
|
||||||
Self::pull_image_from_registry(image, cid, &source_creds, &policy_path, aa_kbc_params)?;
|
Self::pull_image_from_registry(
|
||||||
|
image,
|
||||||
|
&cid,
|
||||||
|
&source_creds,
|
||||||
|
&policy_path,
|
||||||
|
aa_kbc_params,
|
||||||
|
)?;
|
||||||
} else {
|
} else {
|
||||||
let image = image.to_string();
|
let image = image.to_string();
|
||||||
let cid = cid.to_string();
|
let cid = cid.to_string();
|
||||||
@@ -458,7 +465,7 @@ impl ImageService {
|
|||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::unpack_image(cid)?;
|
Self::unpack_image(&cid)?;
|
||||||
|
|
||||||
let mut sandbox = self.sandbox.lock().await;
|
let mut sandbox = self.sandbox.lock().await;
|
||||||
sandbox.images.insert(String::from(image), cid.to_string());
|
sandbox.images.insert(String::from(image), cid.to_string());
|
||||||
|
Reference in New Issue
Block a user