mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-16 23:17:42 +00:00
image_rpc: avoid double and triple indirections
This also slightly improves readability by decluttering the function declaration and call site. Fixes #5405 Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
This commit is contained in:
parent
7dd8b78d44
commit
2e90c62c31
@ -63,8 +63,8 @@ impl ImageService {
|
|||||||
fn pull_image_from_registry(
|
fn pull_image_from_registry(
|
||||||
image: &str,
|
image: &str,
|
||||||
cid: &str,
|
cid: &str,
|
||||||
source_creds: &Option<&str>,
|
source_creds: Option<&str>,
|
||||||
policy_path: &Option<&String>,
|
policy_path: Option<&str>,
|
||||||
aa_kbc_params: &str,
|
aa_kbc_params: &str,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let source_image = format!("{}{}", "docker://", image);
|
let source_image = format!("{}{}", "docker://", image);
|
||||||
@ -262,16 +262,8 @@ impl ImageService {
|
|||||||
if Path::new(SKOPEO_PATH).exists() {
|
if Path::new(SKOPEO_PATH).exists() {
|
||||||
// Read the policy path from the agent config
|
// Read the policy path from the agent config
|
||||||
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.as_str());
|
||||||
|
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,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
Self::unpack_image(&cid)?;
|
Self::unpack_image(&cid)?;
|
||||||
} else {
|
} else {
|
||||||
// TODO #4888 - Create a better way to enable signature verification. This is temporary for the PoC
|
// TODO #4888 - Create a better way to enable signature verification. This is temporary for the PoC
|
||||||
|
Loading…
Reference in New Issue
Block a user