ssg.templates module

class ssg.templates.Builder(env_yaml, resolved_rules_dir, templates_dir, remediations_dir, checks_dir, platforms_dir, cpe_items_dir)[source]

Bases: object

Class for building all templated content for a given product.

To generate content from templates, pass the env_yaml, path to the directory with resolved rule YAMLs, path to the directory that contains templates, path to the output directory for checks and a path to the output directory for remediations into the constructor. Then, call the method build() to perform a build.

build()[source]

Builds all templated content for all languages, writing the output to the correct build directories.

build_all_platforms()[source]
build_all_rules()[source]
build_cpe(cpe)[source]
build_extra_ovals()[source]
build_lang_for_templatable(templatable, lang)[source]

Builds templated content of a given Templatable for a selected language returning the filled template.

build_platform(platform)[source]

Builds templated content of a given Platform (all CPEs/Symbols) for all available languages, writing the output to the correct build directories and updating the platform it self.

build_rule(rule)[source]

Builds templated content of a given Rule for all available languages, writing the output to the correct build directories.

get_lang_contents_for_templatable(templatable, language)[source]

For the specified Templatable, build and return only the specified language content.

get_resolved_langs_to_generate(templatable)[source]

Given a specific Templatable instance, determine which languages are generated by the combination of the template supported_languages AND the Templatable’s template configuration ‘backends’.

process_template_lang_file(template_name, template_vars, lang, local_env_yaml)[source]

Processes template for a given template name and language and returns rendered content.

write_lang_contents_for_templatable(filled_template, lang, templatable)[source]
class ssg.templates.Template(templates_root_directory, name)[source]

Bases: object

classmethod load_template(templates_root_directory, name)[source]
preprocess(parameters, lang)[source]
ssg.templates.TemplatingLang

alias of templating_language_attributes

ssg.templates.load_module(module_name, module_path)[source]