You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shea Craig edited this page Mar 26, 2018
·
4 revisions
In addition to running plugin scripts on the client, you can perform additional processing on the server.
To do so, you should implement the checkin_processor method of your plugin's class. You will need to handle the writing of the data back to the database yourself.
For example, in your plugin.py:
# ...Other imports hereimportsal.pluginfromserver.modelsimport*classMyPlugin(sal.plugin.Widget):
# ...defcheckin_processor(self, machine, report_data):
# ...Do something with the report_dataitem_we_want=report_data['Facter']['somefact']
# Some munging could happen here - maybe sending it to another serviceplugin_name='WhizzyPlugin'plugin_script=PluginScriptSubmission(machine=machine, plugin=plugin_name, historical=False)
plugin_script.save()
data=plugin.get('data')
plugin_row=PluginScriptRow(submission=plugin_script, pluginscript_name='WhizzyData', pluginscript_data=item_we_want, submission_and_script_name=(plugin_name+': '+'WhizzyData'))
plugin_row.save()
For what it's worth, none of the builtin plugins need to use this mechanism.