eikek / docspell

Assist in organizing your piles of documents, resulting from scanners, e-mails and other sources with miminal effort.
https://docspell.org
GNU Affero General Public License v3.0
1.59k stars 120 forks source link

Addon collectOutput documentation does not reflect what actually happens #2629

Closed tiborrr closed 4 months ago

tiborrr commented 4 months ago

I was having a lot of problems launching my addon.

In the documentation it says

  # If true, the stdout of the program is parsed into a JSON structure
  # that is interpreted as actions executed by the task that runs the
  # addon. If the addon runs side effects only, set this to `false`
  # and the output is ignored.
  #
  # It is recommended to use this approach, if possible. It allows
  # docspell itself to apply any changes and the addon can run
  # completely isolated.
  #
  # Default is true.
  collectOutput: true

However when I was testing I saw that my addon output was not being picked up by Docspell

I had to explicitely set collectOutput: true in order for the output to be picked up by Docspel

Before log:

Mon, May 6th, 2024, 12:22: >> [rita-addon-0.17.0 (out)] {"commands": [{"itemId": "9Eakr3kCn2e-2H7so1VmWUM-LjHmNijgsrm-AP9gJjPv6DD", "actions": [{"field": "rita_id", "value": 123, "action": "set-field"}], "command": "item-update"}]}
Mon, May 6th, 2024, 12:22: Closing process: `/tmp/docspell-addons/addon-8281978260616902845/addons/rita-addon-0.17.0/addon.py /tmp/docspell-addons/addon-8281978260616902845/arguments/user-input`
Mon, May 6th, 2024, 12:22: Addon rita-addon-0.17.0 executed successfully!
Mon, May 6th, 2024, 12:22: Addon stdout:

After log:

Mon, May 6th, 2024, 14:14: >> [rita-addon-0.21.0 (out)] {"commands": [{"itemId": "4WpDnRZpHvU-WScpuVHWoAZ-fr84SHY3dR8-P3SCtBGSNVW", "actions": [{"field": "rita_id", "value": "123", "action": "set-field"}], "command": "item-update"}]}
Mon, May 6th, 2024, 14:14: Closing process: `/tmp/docspell-addons/addon-7810609369066464551/addons/rita-addon-0.21.0/addon.py /tmp/docspell-addons/addon-7810609369066464551/arguments/user-input`
Mon, May 6th, 2024, 14:14: Addon rita-addon-0.21.0 executed successfully!
Mon, May 6th, 2024, 14:14: Addon stdout: {"commands": [{"itemId": "4WpDnRZpHvU-WScpuVHWoAZ-fr84SHY3dR8-P3SCtBGSNVW", "actions": [{"field": "rita_id", "value": "123", "action": "set-field"}], "command": "item-update"}]}
Mon, May 6th, 2024, 14:14: Addon result: AddonExecutionResult(List(Success(AddonOutput(List(ItemUpdate(Ident(4WpDnRZpHvU-WScpuVHWoAZ-fr84SHY3dR8-P3SCtBGSNVW),List(SetField(Ident(rita_id),123)))),List(),List()))),true)