Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _compose_variables(self, body_vars, variables, override_vars):
tests_variables = try_get_object(fill_template_str(body_vars,
merge_two_dicts(variables, self.environment)))
variables = merge_two_dicts(variables, tests_variables) # override variables with test's variables
if override_vars:
override_keys = report_override(variables, override_vars)
if override_keys:
debug('Overriding these variables: ' + str(override_keys))
variables = merge_two_dicts(variables, override_vars)
return variables
def _compose_variables(self, body_vars, variables, override_vars):
tests_variables = try_get_object(fill_template_str(body_vars,
merge_two_dicts(variables, self.environment)))
variables = merge_two_dicts(variables, tests_variables) # override variables with test's variables
if override_vars:
override_keys = report_override(variables, override_vars)
if override_keys:
debug('Overriding these variables: ' + str(override_keys))
variables = merge_two_dicts(variables, override_vars)
return variables
def action(self, includes: dict, variables: dict) -> dict:
filled_vars = dict([(k, fill_template_str(v, variables)) for (k, v) in self.variables.items()])
out = fill_template_str(self.include, variables)
test, tag = get_tag(out)
if test not in includes:
error('No include registered for name ' + test)
raise Exception('No include registered for name ' + test)
include = includes[test]
variables = merge_two_dicts(include.variables, merge_two_dicts(variables, filled_vars))
include.variables = try_get_object(fill_template_str(variables, variables))
try:
info('Running {}.{}'.format(test, '' if tag is None else tag))
logger.log_storage.nested_test_in()
variables = include.run(tag=tag, raise_stop=True)
logger.log_storage.nested_test_out()
except SkipException:
logger.log_storage.nested_test_out()
debug('Include ignored')
return variables
except StopException as e:
logger.log_storage.nested_test_out()
raise e
except Exception as e:
logger.log_storage.nested_test_out()
if not self.ignore_errors:
def _compose_variables(self, body_vars, variables, override_vars):
tests_variables = try_get_object(fill_template_str(body_vars,
merge_two_dicts(variables, self.environment)))
variables = merge_two_dicts(variables, tests_variables) # override variables with test's variables
if override_vars:
override_keys = report_override(variables, override_vars)
if override_keys:
debug('Overriding these variables: ' + str(override_keys))
variables = merge_two_dicts(variables, override_vars)
return variables
inventory: str or None,
modules=None,
environment=None,
system_environment=None,
resources=None,
output_format=None,
filter_list=None) -> None:
if modules is None:
modules = []
self.environment = environment if environment is not None else {}
self.system_vars = system_environment if system_environment is not None else {}
self.tests_path = tests_path
self.path = path
self.inventory = inventory
self.all_includes = None
self.modules = merge_two_dicts(prepare_modules(modules, step.registered_steps), step.registered_steps)
self._compose = DockerCompose(resources)
self.resources = resources
if output_format:
logger.log_storage = LogStorage(output_format)
FiltersHolder(filter_list)