New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[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
KevinDavidMitnick opened this Issue Jan 3, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@KevinDavidMitnick
Copy link

KevinDavidMitnick commented Jan 3, 2019

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

@KevinDavidMitnick KevinDavidMitnick 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 Jan 3, 2019

@Kami Kami self-assigned this Jan 3, 2019

@Kami

This comment has been minimized.

Copy link
Member

Kami commented Jan 3, 2019

Thanks for reporting this.

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

@Kami

This comment has been minimized.

Copy link
Member

Kami commented Jan 7, 2019

@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.

@Kami

This comment has been minimized.

Copy link
Member

Kami commented Jan 7, 2019

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.

@Kami Kami closed this in #4491 Jan 8, 2019

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