mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-09 12:54:18 +00:00
fail if dynvariables cannot be executed successfully
This commit is contained in:
@@ -209,7 +209,12 @@ class CfgYaml:
|
|||||||
|
|
||||||
# exec dynvariables
|
# exec dynvariables
|
||||||
for k in dvar.keys():
|
for k in dvar.keys():
|
||||||
allvars[k] = shell(allvars[k])
|
ret, out = shell(allvars[k])
|
||||||
|
if not ret:
|
||||||
|
err = 'command \"{}\" failed: {}'.format(allvars[k], out)
|
||||||
|
self.log.error(err)
|
||||||
|
raise YamlException(err)
|
||||||
|
allvars[k] = out
|
||||||
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
self.log.dbg('variables:')
|
self.log.dbg('variables:')
|
||||||
|
|||||||
@@ -49,8 +49,12 @@ def write_to_tmpfile(content):
|
|||||||
|
|
||||||
|
|
||||||
def shell(cmd):
|
def shell(cmd):
|
||||||
"""run a command in the shell (expects a string)"""
|
"""
|
||||||
return subprocess.getoutput(cmd)
|
run a command in the shell (expects a string)
|
||||||
|
returns True|False, output
|
||||||
|
"""
|
||||||
|
ret, out = subprocess.getstatusoutput(cmd)
|
||||||
|
return ret == 0, out
|
||||||
|
|
||||||
|
|
||||||
def diff(src, dst, raw=True, opts='', debug=False):
|
def diff(src, dst, raw=True, opts='', debug=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user