9.3.3. PLUGIN VARIABLE: ANALYZE_DATAΒΆ

The calculations to perform for this plugin when “analyze_data” mode is enabled set as an dictionary variable ANALYZE_DATA.

Use an OrderedDict to ensure calculations are run in the order defined in the plugin.

This should be a dictionary that defines a mapping of “calculation_name” => “calculation string”.

The dictionary key “calculation_name” is a string set to the name to use to store the result of “calculation string”.

The dictionary value “calculation string” is a string set to a snippet of python code that does something.

Each “calculation string” must always set a result variable to be consumed by the plugin system, for example:

1
2
3
4
5
6
7
8
9
NAME = "plugin_name"

ANALYZE_DATA = OrderedDict()

ANALYZE_DATA["two_plus_five"] = """
# add 2 and 5 to set result to 7

result = 2 + 5
"""

Note

Each “calculation_name” is the same name that must be used in layout files when pulling in data to the PPTX file dynamically using fetch. Given the example above, you could use {{ fetch('plugin_name', 'two_plus_five') }} to insert the result of this calculation string into any placeholder item on a slide.

Each “calculation string” is run from within the context of a tanium_hat.plugin.Plugin. This means that each calculation has a number of helper methods available to by using foo = self.helper_method(arg1, arg2, etc). Helper methods provided in Plugin: