Skip to content
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

Creating a rule with the default criteria operator fails #897

Open
winem opened this issue Jun 19, 2021 · 3 comments
Open

Creating a rule with the default criteria operator fails #897

winem opened this issue Jun 19, 2021 · 3 comments
Labels

Comments

@winem
Copy link

winem commented Jun 19, 2021

I tried to create a rule that reacts on a specific slack message.

Selection_264

The criteria operator has not been changed and is still the one that's shown per default (regex).

Saving the rule fails with:

{ "faultstring": "For field: trigger.text, operator not in list of allowed operators: ['matchwildcard', 'matchregex', 'regex', 'iregex', 'eq', 'equals', 'neq', 'nequals', 'ieq', 'iequals', 'contains', 'icontains', 'ncontains', 'incontains', 'startswith', 'istartswith', 'endswith', 'iendswith', 'lt', 'lessthan', 'gt', 'greaterthan', 'td_lt', 'timediff_lt', 'td_gt', 'timediff_gt', 'exists', 'nexists', 'inside', 'in', 'ninside', 'nin', 'search']" }

This happens because the preselected operator is not sent to the backend as a look on the request parameters shows:

{
  "pack": "slack",
  "enabled": true,
  "trigger": {
    "type": "slack.message",
    "parameters": {}
  },
  "criteria": {
    "trigger.text": {
      "type": "",
      "pattern": "foo"
    }
  },
  "action": {
    "ref": "core.local",
    "parameters": {
      "cmd": "date -u"
    }
  },
  "name": "slack2",
  "description": "slack"
}

criteria.trigger.text.type should be regex.

It works fine if you select any other operator or any other operator and then regex again.

@amanda11
Copy link
Contributor

@winem - is this a new problem in 3.5? Would be good to confirm this is new to 3.5.
If it's new to 3.5 then @m4dcoder i wonder if you know of any changes it's related to?

@amanda11
Copy link
Contributor

I do wonder if this has always been the case. Eg I recall if you create a rule and don't choose a pack then it fails to save - even though it shows a default pack of "default". You did always have to actually specify the value rather than the default.

If it's always been a problem then we should raise an issue, but it wouldn't be a blocker.

@winem
Copy link
Author

winem commented Jun 19, 2021

I don't think that it's related to 3.5 and it wouldn't be a release blocker as the workaround is fairly easy.

I'll do some more tests on older releases tomorrow to see if any of the (potential) issues I saw so far is being introduced with 3.5 or an old one.

@cognifloyd cognifloyd added the bug label Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants