From c8edb2102f72df43c0c4563f81ef5ce5931c9a31 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 16 Jul 2016 00:08:58 +0200 Subject: [PATCH] Fix AspectConfig::get_for() implementation --- libimagstore/src/configuration.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libimagstore/src/configuration.rs b/libimagstore/src/configuration.rs index d0be520a..6f2d405f 100644 --- a/libimagstore/src/configuration.rs +++ b/libimagstore/src/configuration.rs @@ -200,6 +200,7 @@ pub struct AspectConfig { impl AspectConfig { pub fn new(init: Value) -> AspectConfig { + debug!("Trying to parse AspectConfig from: {:?}", init); let parallel = AspectConfig::is_parallel(&init); let muthooks = AspectConfig::allows_mutable_hooks(&init); AspectConfig { @@ -247,11 +248,21 @@ impl AspectConfig { /// /// Returns `None` if one of the keys in the chain is not available pub fn get_for(v: &Option, a_name: String) -> Option { - match *v { - Some(Value::Table(ref tabl)) => tabl.get(&a_name[..]) - .map(|asp| AspectConfig::new(asp.clone())), + debug!("Get aspect configuration for {:?} from {:?}", a_name, v); + let res = match *v { + Some(Value::Table(ref tabl)) => { + match tabl.get("aspects") { + Some(&Value::Table(ref tabl)) => { + tabl.get(&a_name[..]).map(|asp| AspectConfig::new(asp.clone())) + }, + + _ => None, + } + }, _ => None, - } + }; + debug!("Found aspect configuration for {:?}: {:?}", a_name, res); + res } }