Skip to content

[st2reactor] Issue about validation fail before dispatching trigger,Trigger type with reference "linux.cd875f82-58d6-47ff-9eff-11bd81493bf7" doesn't exist in the database #4486

Closed

Description

@KevinDavidMitnick

wen I test sensor linux.FileWatchSensor:

root@6206c3910cd6:/opt/stackstorm/packs/linux/sensors# st2 sensor get linux.FileWatchSensor 
+---------------+--------------------------------------------------------------+
| Property      | Value                                                        |
+---------------+--------------------------------------------------------------+
| id            | 5c2d8324d28ef50172db13e9                                     |
| uid           | sensor_type:linux:FileWatchSensor                            |
| ref           | linux.FileWatchSensor                                        |
| pack          | linux                                                        |
| name          | FileWatchSensor                                              |
| enabled       | True                                                         |
| entry_point   | sensors.file_watch_sensor.FileWatchSensor                    |
| artifact_uri  | file:///opt/stackstorm/packs/linux/sensors/file_watch_sensor |
|               | .py                                                          |
| trigger_types | [                                                            |
|               |     "linux.file_watch.line"                                  |
|               | ]                                                            |
| description   | Sensor which monitors files for new lines                    |
| metadata_file | sensors/file_watch_sensor.yaml                               |
+---------------+--------------------------------------------------------------+

I use rule as follow:

root@6206c3910cd6:/opt/stackstorm/packs/examples/rules# cat sample_rule_file_watch.yaml 
---
name: sample_rule_file_watch
pack: "examples"
description: Sample rule custom trigger type - add a file to be watched by file_watch_sensor in linux pack.
enabled: true

trigger:
  parameters:
    file_path: /tmp/st2_test
  type: linux.file_watch.line

criteria: {}

action:
  parameters:
    cmd: echo "{{trigger}}"
  ref: core.local

I execute cmd, like this:
echo >> liucong /tmp/st2_test

and err log in /var/log/st2/st2sensorcontainer.log as follows:

2019-01-03 03:39:07,046 139683133441840 INFO tail [-] Tailing /tmp/st2_test
2019-01-03 03:39:07,047 139683133441840 INFO file_watch_sensor [-] Added file "/tmp/st2_test"
2019-01-03 03:41:00,852 139683181345520 WARNING trigger_dispatcher [-] Failed to validate payload ({'file_name': u'st2_test', 'line': u'liucong', 'file_path': u'/tmp/st2_test'}) for trigger "linux.cd875f82-58d6-47ff-9eff-11bd81493bf7": Trigger type with reference "linux.cd875f82-58d6-47ff-9eff-11bd81493bf7" doesn't exist in the database

Activity

  1. changed the title [-][st2reactor] Issue about validation fail before dispatching trigger[/-] [+][st2reactor] Issue about validation fail before dispatching trigger,Trigger type with reference "linux.cd875f82-58d6-47ff-9eff-11bd81493bf7" doesn't exist in the database[/+] on Jan 3, 2019
  2. self-assigned this
    on Jan 3, 2019
  3. Kami commented on Jan 3, 2019

    @Kami
    Member

    Thanks for reporting this.

    I will try to reproduce this issue and have a look early next week by the latest.

  4. Kami commented on Jan 7, 2019

    @Kami
    Member

    @KevinDavidMitnick I'm looking into this today.

    In the mean time (until the bug is confirmed and a new version with fix released) you can set system.validate_trigger_payload config option to /etc/st2/st2.conf to False and restart the services (sudo st2ctl restart).

    This should serve as a temporary workaround.

  5. Kami commented on Jan 7, 2019

    @Kami
    Member

    It was indeed a bug in our trigger payload validation code which didn't correctly account for an edge case with triggers - #4491.

    The bug fix will be included in the next release. In the mean time, you can use the workaround documented in the comment above.

    Sorry for the inconvenience and thanks again for reporting this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions