mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-16 09:26:11 +00:00
fix bug in profile inheritance
This commit is contained in:
@@ -322,15 +322,15 @@ class CfgYaml:
|
|||||||
for k, v in self.profiles.items():
|
for k, v in self.profiles.items():
|
||||||
if self.key_profile_include in v:
|
if self.key_profile_include in v:
|
||||||
new = []
|
new = []
|
||||||
for k in v[self.key_profile_include]:
|
for x in v[self.key_profile_include]:
|
||||||
new.append(t.generate_string(k))
|
new.append(t.generate_string(x))
|
||||||
v[self.key_profile_include] = new
|
v[self.key_profile_include] = new
|
||||||
|
|
||||||
# now get the included ones
|
# now get the included ones
|
||||||
pro_var = self._get_included_variables(self.profile,
|
pro_var = self._get_profile_included_variables(self.profile,
|
||||||
seen=[self.profile])
|
seen=[self.profile])
|
||||||
pro_dvar = self._get_included_dvariables(self.profile,
|
pro_dvar = self._get_profile_included_dvariables(self.profile,
|
||||||
seen=[self.profile])
|
seen=[self.profile])
|
||||||
# exec incl dynvariables
|
# exec incl dynvariables
|
||||||
self._shell_exec_dvars(pro_dvar.keys(), pro_dvar)
|
self._shell_exec_dvars(pro_dvar.keys(), pro_dvar)
|
||||||
|
|
||||||
@@ -459,8 +459,8 @@ class CfgYaml:
|
|||||||
variables = deepcopy(self.ori_dvariables)
|
variables = deepcopy(self.ori_dvariables)
|
||||||
return variables
|
return variables
|
||||||
|
|
||||||
def _get_included_variables(self, profile, seen):
|
def _get_profile_included_variables(self, profile, seen):
|
||||||
"""return included variables"""
|
"""return included variables from profile"""
|
||||||
variables = {}
|
variables = {}
|
||||||
if not profile or profile not in self.profiles.keys():
|
if not profile or profile not in self.profiles.keys():
|
||||||
return variables
|
return variables
|
||||||
@@ -473,8 +473,8 @@ class CfgYaml:
|
|||||||
if inherited_profile == profile or inherited_profile in seen:
|
if inherited_profile == profile or inherited_profile in seen:
|
||||||
raise YamlException('\"include\" loop')
|
raise YamlException('\"include\" loop')
|
||||||
seen.append(inherited_profile)
|
seen.append(inherited_profile)
|
||||||
new = self._get_included_variables(inherited_profile,
|
new = self._get_profile_included_variables(inherited_profile,
|
||||||
seen)
|
seen)
|
||||||
if self.debug:
|
if self.debug:
|
||||||
msg = 'included vars from {}: {}'
|
msg = 'included vars from {}: {}'
|
||||||
self.log.dbg(msg.format(inherited_profile, new))
|
self.log.dbg(msg.format(inherited_profile, new))
|
||||||
@@ -483,8 +483,8 @@ class CfgYaml:
|
|||||||
cur = pentry.get(self.key_profile_variables, {})
|
cur = pentry.get(self.key_profile_variables, {})
|
||||||
return self._merge_dict(cur, variables)
|
return self._merge_dict(cur, variables)
|
||||||
|
|
||||||
def _get_included_dvariables(self, profile, seen):
|
def _get_profile_included_dvariables(self, profile, seen):
|
||||||
"""return included dynvariables"""
|
"""return included dynvariables from profile"""
|
||||||
variables = {}
|
variables = {}
|
||||||
|
|
||||||
if not profile or profile not in self.profiles.keys():
|
if not profile or profile not in self.profiles.keys():
|
||||||
@@ -498,7 +498,8 @@ class CfgYaml:
|
|||||||
if inherited_profile == profile or inherited_profile in seen:
|
if inherited_profile == profile or inherited_profile in seen:
|
||||||
raise YamlException('\"include loop\"')
|
raise YamlException('\"include loop\"')
|
||||||
seen.append(inherited_profile)
|
seen.append(inherited_profile)
|
||||||
new = self._get_included_dvariables(inherited_profile, seen)
|
new = self._get_profile_included_dvariables(inherited_profile,
|
||||||
|
seen)
|
||||||
if self.debug:
|
if self.debug:
|
||||||
msg = 'included dvars from {}: {}'
|
msg = 'included dvars from {}: {}'
|
||||||
self.log.dbg(msg.format(inherited_profile, new))
|
self.log.dbg(msg.format(inherited_profile, new))
|
||||||
|
|||||||
Reference in New Issue
Block a user