mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 00:54:16 +00:00
fix bug #268
This commit is contained in:
@@ -253,6 +253,16 @@ class CfgYaml:
|
|||||||
# public methods
|
# public methods
|
||||||
########################################################
|
########################################################
|
||||||
|
|
||||||
|
def _resolve_dotfile_link(self, link):
|
||||||
|
"""resolve dotfile link entry"""
|
||||||
|
newlink = self._template_item(link)
|
||||||
|
# check link value
|
||||||
|
if newlink not in self.allowed_link_val:
|
||||||
|
err = 'bad value: {}'.format(newlink)
|
||||||
|
self._log.err(err)
|
||||||
|
raise YamlException('config content error: {}'.format(err))
|
||||||
|
return newlink
|
||||||
|
|
||||||
def resolve_dotfile_src(self, src, templater=None):
|
def resolve_dotfile_src(self, src, templater=None):
|
||||||
"""resolve dotfile src path"""
|
"""resolve dotfile src path"""
|
||||||
newsrc = ''
|
newsrc = ''
|
||||||
@@ -1126,7 +1136,17 @@ class CfgYaml:
|
|||||||
if dst is None:
|
if dst is None:
|
||||||
dotfile[self.key_dotfile_dst] = ''
|
dotfile[self.key_dotfile_dst] = ''
|
||||||
|
|
||||||
# only keep dotfiles related to the selected profile
|
# resolve links before taking subset of
|
||||||
|
# dotfiles to avoid issues in upper layer
|
||||||
|
for dotfile in dotfiles.values():
|
||||||
|
# link
|
||||||
|
if self.key_dotfile_link in dotfile:
|
||||||
|
# normalize the link value
|
||||||
|
link = dotfile[self.key_dotfile_link]
|
||||||
|
newlink = self._resolve_dotfile_link(link)
|
||||||
|
dotfile[self.key_dotfile_link] = newlink
|
||||||
|
|
||||||
|
# only keep dotfiles related to the selected profile
|
||||||
pdfs = []
|
pdfs = []
|
||||||
pro = self.profiles.get(self._profile, [])
|
pro = self.profiles.get(self._profile, [])
|
||||||
if pro:
|
if pro:
|
||||||
@@ -1156,17 +1176,6 @@ class CfgYaml:
|
|||||||
dst = dotfile[self.key_dotfile_dst]
|
dst = dotfile[self.key_dotfile_dst]
|
||||||
newdst = self.resolve_dotfile_dst(dst, templater=self._tmpl)
|
newdst = self.resolve_dotfile_dst(dst, templater=self._tmpl)
|
||||||
dotfile[self.key_dotfile_dst] = newdst
|
dotfile[self.key_dotfile_dst] = newdst
|
||||||
# normalize the link value
|
|
||||||
if self.key_dotfile_link in dotfile:
|
|
||||||
# link
|
|
||||||
link = dotfile[self.key_dotfile_link]
|
|
||||||
newlink = self._template_item(link)
|
|
||||||
dotfile[self.key_dotfile_link] = newlink
|
|
||||||
# check link value
|
|
||||||
if newlink not in self.allowed_link_val:
|
|
||||||
err = 'bad value: {}'.format(newlink)
|
|
||||||
self._log.err(err)
|
|
||||||
raise YamlException('config content error: {}'.format(err))
|
|
||||||
|
|
||||||
def _rec_resolve_variables(self, variables):
|
def _rec_resolve_variables(self, variables):
|
||||||
"""recursive resolve variables"""
|
"""recursive resolve variables"""
|
||||||
|
|||||||
Reference in New Issue
Block a user