Commit 23d75b14 authored by David Danier's avatar David Danier

Changing the linter changes a little, this suits me better

parent 62acbc94
......@@ -17,7 +17,7 @@ def find_configs(state, configs):
'path': config_path,
})
# if not found_configs:
# raise B5ExecutionError('No config found, tried %s inside %s' % (', '.join(configs), run_path))
# raise B5ExecutionError('No config found, tried %s inside %s' % (', '.join(configs), run_path))
return found_configs
......@@ -48,9 +48,9 @@ def validate_config(config):
def load_config(state):
config_files = state.configfiles
configfiles = state.configfiles
config = {}
for configfile in config_files:
for configfile in configfiles:
file_handle = open(configfile['path'], 'r')
file_config = yaml.safe_load(file_handle)
if not isinstance(file_config, dict):
......
import os
import re
import shlex
import tempfile
from .module import load_module
RE_KEY_ESCAPE = re.compile('[^a-zA-Z0-9]+')
CONFIG_SUB = '%s_%s'
CONFIG_KEYS = '%s_KEYS'
def modules_script_source(state):
script = []
if 'modules' in state.config:
......@@ -15,20 +21,14 @@ def modules_script_source(state):
def config_script_source(config, prefix='CONFIG'):
import re
re_key_escape = re.compile('[^a-zA-Z0-9]+')
config_sub = '%s_%s'
config_keys = '%s_KEYS'
def _gen_config(config_node, prefix):
script = []
if isinstance(config_node, dict):
for key in config_node:
escaped_key = re_key_escape.sub('_', key)
script.append(_gen_config(config_node[key], config_sub % (prefix, escaped_key)))
script.append('%s=(%s)' % (config_keys % prefix, ' '.join([shlex.quote(k) for k in config_node])))
escaped_key = RE_KEY_ESCAPE.sub('_', key)
script.append(_gen_config(config_node[key], CONFIG_SUB % (prefix, escaped_key)))
script.append('%s=(%s)' % (CONFIG_KEYS % prefix, ' '.join([shlex.quote(k) for k in config_node])))
elif isinstance(config_node, list):
script.append('%s=(%s)' % (prefix, ' '.join([
shlex.quote(k)
......@@ -85,7 +85,6 @@ def construct_script_source(state):
# run_path and parse Taskfile's
script.append('cd %s\n' % shlex.quote(state.run_path))
for taskfile in state.taskfiles:
# script.append('source %s\n' % shlex.quote(taskfile['path']))
script.append(open(taskfile['path'], 'r').read())
return '\n'.join(script)
......
......@@ -112,8 +112,6 @@ def main():
construct_script_run(state),
])
with StoredScriptSource(state, script_source) as source:
# print(source.source)
# return
if state.run_path:
os.chdir(state.run_path)
try:
......@@ -132,7 +130,6 @@ def main():
termcolor.cprint('Task execution failed, see above', color='red')
sys.exit(1)
_print('Task exited ok', color='green')
# print(result)
except B5ExecutionError as error:
termcolor.cprint(str(error), 'red')
sys.exit(1)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment