mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 06:52:13 +00:00
Merge pull request #8558 from jodh-intel/load-config-improvement
runtime-rs: Show config files attempted on config load failure
This commit is contained in:
commit
d9daadf15c
@ -216,6 +216,14 @@ impl TomlConfig {
|
|||||||
|
|
||||||
Err(io::Error::from(io::ErrorKind::NotFound))
|
Err(io::Error::from(io::ErrorKind::NotFound))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return a list of default config file paths.
|
||||||
|
pub fn get_default_config_file_list() -> Vec<PathBuf> {
|
||||||
|
default::DEFAULT_RUNTIME_CONFIGURATIONS
|
||||||
|
.iter()
|
||||||
|
.map(|s| PathBuf::from(*s))
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Validate the `path` matches one of the pattern in `patterns`.
|
/// Validate the `path` matches one of the pattern in `patterns`.
|
||||||
|
@ -489,8 +489,10 @@ fn load_config(spec: &oci::Spec, option: &Option<Vec<u8>>) -> Result<TomlConfig>
|
|||||||
let logger = slog::Logger::clone(&slog_scope::logger());
|
let logger = slog::Logger::clone(&slog_scope::logger());
|
||||||
|
|
||||||
info!(logger, "get config path {:?}", &config_path);
|
info!(logger, "get config path {:?}", &config_path);
|
||||||
let (mut toml_config, _) =
|
let (mut toml_config, _) = TomlConfig::load_from_file(&config_path).context(format!(
|
||||||
TomlConfig::load_from_file(&config_path).context("load toml config")?;
|
"load TOML config failed (tried {:?})",
|
||||||
|
TomlConfig::get_default_config_file_list()
|
||||||
|
))?;
|
||||||
annotation.update_config_by_annotation(&mut toml_config)?;
|
annotation.update_config_by_annotation(&mut toml_config)?;
|
||||||
update_agent_kernel_params(&mut toml_config)?;
|
update_agent_kernel_params(&mut toml_config)?;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ impl TaskService {
|
|||||||
debug!(logger, "====> task service {:?}", &r);
|
debug!(logger, "====> task service {:?}", &r);
|
||||||
let resp =
|
let resp =
|
||||||
self.handler.handler_message(r).await.map_err(|err| {
|
self.handler.handler_message(r).await.map_err(|err| {
|
||||||
ttrpc::Error::Others(format!("failed to handler message {:?}", err))
|
ttrpc::Error::Others(format!("failed to handle message {:?}", err))
|
||||||
})?;
|
})?;
|
||||||
debug!(logger, "<==== task service {:?}", &resp);
|
debug!(logger, "<==== task service {:?}", &resp);
|
||||||
resp.try_into()
|
resp.try_into()
|
||||||
|
Loading…
Reference in New Issue
Block a user