fix: return an error if the activation of tmp files fails (#255)
We want system-manager to return an error if the activation of tmp files fails.
This commit is contained in:
parent
c64d185d2c
commit
ba09b781b1
1 changed files with 19 additions and 15 deletions
|
|
@ -82,18 +82,16 @@ pub fn activate(store_path: &StorePath, ephemeral: bool) -> Result<()> {
|
||||||
match etc_files::activate(store_path, old_state.file_tree, ephemeral) {
|
match etc_files::activate(store_path, old_state.file_tree, ephemeral) {
|
||||||
Ok(etc_tree) => {
|
Ok(etc_tree) => {
|
||||||
log::info!("Activating tmp files...");
|
log::info!("Activating tmp files...");
|
||||||
match tmp_files::activate(&etc_tree) {
|
let tmp_result = tmp_files::activate(&etc_tree);
|
||||||
Ok(_) => {
|
if let Err(e) = &tmp_result {
|
||||||
log::debug!("Successfully created tmp files");
|
log::error!("Error during activation of tmp files");
|
||||||
}
|
log::error!("{e}");
|
||||||
Err(e) => {
|
} else {
|
||||||
log::error!("Error during activation of tmp files");
|
log::debug!("Successfully created tmp files");
|
||||||
log::error!("{e}");
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
log::info!("Activating systemd services...");
|
log::info!("Activating systemd services...");
|
||||||
match services::activate(store_path, old_state.services, ephemeral) {
|
let final_state = match services::activate(store_path, old_state.services, ephemeral) {
|
||||||
Ok(services) => State {
|
Ok(services) => State {
|
||||||
file_tree: etc_tree,
|
file_tree: etc_tree,
|
||||||
services,
|
services,
|
||||||
|
|
@ -105,19 +103,25 @@ pub fn activate(store_path: &StorePath, ephemeral: bool) -> Result<()> {
|
||||||
services: result,
|
services: result,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
final_state.write_to_file(state_file)?;
|
||||||
|
|
||||||
|
if let Err(e) = tmp_result {
|
||||||
|
return Err(e.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
Err(ActivationError::WithPartialResult { result, source }) => {
|
Err(ActivationError::WithPartialResult { result, source }) => {
|
||||||
log::error!("Error during activation: {source:?}");
|
log::error!("Error during activation: {source:?}");
|
||||||
State {
|
let final_state = State {
|
||||||
file_tree: result,
|
file_tree: result,
|
||||||
..old_state
|
..old_state
|
||||||
}
|
};
|
||||||
|
final_state.write_to_file(state_file)?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.write_to_file(state_file)?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn prepopulate(store_path: &StorePath, ephemeral: bool) -> Result<()> {
|
pub fn prepopulate(store_path: &StorePath, ephemeral: bool) -> Result<()> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue