st2 icon indicating copy to clipboard operation
st2 copied to clipboard

The built-in "st2.action.file_written" trigger is not working.

Open lehuythangit opened this issue 3 years ago • 0 comments

SUMMARY

The "st2.action.file_written" trigger is not working when creating a new action.

STACKSTORM VERSION

3.7

OS, environment, install method
  • Window 10, WSL 2: Ubuntu 22.04
  • Docker

Steps to reproduce the problem

  • Create a new rule with "st2.action.file_written" trigger and "core.echo" for output the payload of the trigger.
  • Create a new action by st2client or st2web.

Expected Results

Execute the rule and output the payload of st2.action.file_written trigger.

Actual Results

Nothing!

Root cause:

Missing the "pack" info when dispatching this trigger: https://github.com/StackStorm/st2/blob/v3.7/st2api/st2api/controllers/v1/actions.py#L533

def _dispatch_trigger_for_written_data_files(self, action_db, written_data_files):
        trigger = ACTION_FILE_WRITTEN_TRIGGER["name"]
        host_info = get_host_info()

        for file_path in written_data_files:
            payload = {
                "ref": action_db.ref,
                "file_path": file_path,
                "host_info": host_info,
            }
            self._trigger_dispatcher.dispatch(trigger=trigger, payload=payload)

Thanks!

lehuythangit avatar Jul 03 '22 05:07 lehuythangit