mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-24 02:31:12 +00:00
agent: Update image_rpc
- Update image_rpc to reflect the changes in code gen Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
parent
8b8e71fa65
commit
9bdd9af898
@ -122,17 +122,17 @@ impl ImageService {
|
|||||||
/// If the request specifies a non-empty id, use it; otherwise derive it from the image path.
|
/// If the request specifies a non-empty id, use it; otherwise derive it from the image path.
|
||||||
/// In either case, verify that the chosen id is valid.
|
/// In either case, verify that the chosen id is valid.
|
||||||
fn cid_from_request(&self, req: &image::PullImageRequest) -> Result<String> {
|
fn cid_from_request(&self, req: &image::PullImageRequest) -> Result<String> {
|
||||||
let req_cid = req.get_container_id();
|
let req_cid = req.container_id();
|
||||||
let cid = if !req_cid.is_empty() {
|
let cid = if !req_cid.is_empty() {
|
||||||
req_cid.to_string()
|
req_cid.to_string()
|
||||||
} else if let Some(last) = req.get_image().rsplit('/').next() {
|
} else if let Some(last) = req.image().rsplit('/').next() {
|
||||||
// Support multiple containers with same image
|
// Support multiple containers with same image
|
||||||
let index = self.container_count.fetch_add(1, Ordering::Relaxed);
|
let index = self.container_count.fetch_add(1, Ordering::Relaxed);
|
||||||
|
|
||||||
// ':' not valid for container id
|
// ':' not valid for container id
|
||||||
format!("{}_{}", last.replace(':', "_"), index)
|
format!("{}_{}", last.replace(':', "_"), index)
|
||||||
} else {
|
} else {
|
||||||
return Err(anyhow!("Invalid image name. {}", req.get_image()));
|
return Err(anyhow!("Invalid image name. {}", req.image()));
|
||||||
};
|
};
|
||||||
verify_cid(&cid)?;
|
verify_cid(&cid)?;
|
||||||
Ok(cid)
|
Ok(cid)
|
||||||
@ -152,7 +152,7 @@ impl ImageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cid = self.cid_from_request(req)?;
|
let cid = self.cid_from_request(req)?;
|
||||||
let image = req.get_image();
|
let image = req.image();
|
||||||
if cid.starts_with("pause") {
|
if cid.starts_with("pause") {
|
||||||
Self::unpack_pause_image(&cid)?;
|
Self::unpack_pause_image(&cid)?;
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ impl ImageService {
|
|||||||
);
|
);
|
||||||
self.image_client.lock().await.config.security_validate = *enable_signature_verification;
|
self.image_client.lock().await.config.security_validate = *enable_signature_verification;
|
||||||
|
|
||||||
let source_creds = (!req.get_source_creds().is_empty()).then(|| req.get_source_creds());
|
let source_creds = (!req.source_creds().is_empty()).then(|| req.source_creds());
|
||||||
|
|
||||||
let bundle_path = Path::new(CONTAINER_BASE).join(&cid);
|
let bundle_path = Path::new(CONTAINER_BASE).join(&cid);
|
||||||
fs::create_dir_all(&bundle_path)?;
|
fs::create_dir_all(&bundle_path)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user