From eb9cae54daa8e123371b0e2c11ee3d8f94e237ae Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Wed, 19 Jun 2019 19:36:44 +0200 Subject: [PATCH] fix bug for #168 --- dotdrop/cfg_yaml.py | 14 ++++++++++++-- tests-ng/variables-include.sh | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dotdrop/cfg_yaml.py b/dotdrop/cfg_yaml.py index 6a40a87..efb5b00 100644 --- a/dotdrop/cfg_yaml.py +++ b/dotdrop/cfg_yaml.py @@ -410,8 +410,13 @@ class CfgYaml: seen.append(inherited_profile) new = self._get_included_variables(inherited_profile, seen) + if self.debug: + msg = 'included vars from {}: {}' + self.log.dbg(msg.format(inherited_profile, new)) variables.update(new) - return pentry.get(self.key_profile_variables, {}) + + cur = pentry.get(self.key_profile_variables, {}) + return self._merge_dict(variables, cur) def _get_included_dvariables(self, profile, seen): """return included dynvariables""" @@ -429,8 +434,13 @@ class CfgYaml: raise YamlException('\"include loop\"') seen.append(inherited_profile) new = self._get_included_dvariables(inherited_profile, seen) + if self.debug: + msg = 'included dvars from {}: {}' + self.log.dbg(msg.format(inherited_profile, new)) variables.update(new) - return pentry.get(self.key_profile_dvariables, {}) + + cur = pentry.get(self.key_profile_dvariables, {}) + return self._merge_dict(variables, cur) def _resolve_profile_all(self): """resolve some other parts of the config""" diff --git a/tests-ng/variables-include.sh b/tests-ng/variables-include.sh index 4768312..b67f56d 100755 --- a/tests-ng/variables-include.sh +++ b/tests-ng/variables-include.sh @@ -101,7 +101,7 @@ grep '^another test' ${tmpd}/abc >/dev/null cd ${ddpath} | ${bin} install -f -c ${cfg} -p p2 cat ${tmpd}/abc -grep '^this is some test' ${tmpd}/abc >/dev/null +grep '^this is some sub-test' ${tmpd}/abc >/dev/null grep '^42' ${tmpd}/abc >/dev/null grep '^another test' ${tmpd}/abc >/dev/null