Fix StoreId::exists() usage

This commit is contained in:
Matthias Beyer 2017-02-27 13:21:55 +01:00
parent 111943e0eb
commit c2838cca3b

View file

@ -68,20 +68,25 @@ impl HookDataAccessorProvider for LinkedEntriesExistHook {
impl NonMutableHookDataAccessor for LinkedEntriesExistHook { impl NonMutableHookDataAccessor for LinkedEntriesExistHook {
fn access(&self, fle: &FileLockEntry) -> HookResult<()> { fn access(&self, fle: &FileLockEntry) -> HookResult<()> {
use libimagstore::hook::error::HookErrorKind;
use libimagstore::hook::error::MapErrInto;
debug!("[LINKVERIFY HOOK] {:?}", fle.get_location()); debug!("[LINKVERIFY HOOK] {:?}", fle.get_location());
let _ = fle.get_internal_links() match fle.get_internal_links() {
.map(|links| { Ok(links) => {
for link in links { for link in links {
if !link.exists() { if !try!(link.exists().map_err_into(HookErrorKind::HookExecutionError)) {
warn!("File link does not exist: {:?} -> {:?}", fle.get_location(), link); warn!("File link does not exist: {:?} -> {:?}", fle.get_location(), link);
} }
} }
}) Ok(())
.map_err(|e| { },
Err(e) => {
warn!("Couldn't execute Link-Verify hook"); warn!("Couldn't execute Link-Verify hook");
trace_error(&e); trace_error(&e);
}); Err(e).map_err_into(HookErrorKind::HookExecutionError)
Ok(()) }
}
} }
} }