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

got Expected end of text, found '(' when trying out example snippet from doc #495

Open
3 tasks done
tarilabs opened this issue Apr 27, 2023 · 1 comment
Open
3 tasks done

Comments

@tarilabs
Copy link
Contributor

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that ansible-rulebook is open source software provided for free and that I might not receive a timely response.

Bug Summary

I'm trying a variation of this snippet example from the doc:

rules:
- name: r1
condition:
all:
- event.request.type == "Delete"
- event.friend_list.names contains events.m_0.request.friend_name
action:
print_event:

Accounting for #493
Using webhook instead of generic source (see also #494)

So the example I'm trying in full reads as:

---
- name: Delayed comparison
  hosts: all
  sources:
    - ansible.eda.webhook:
        host: 0.0.0.0
        port: 5050 # use 5050 as on Mac OSX the 5000 is already reserved by default OS
  rules:
    - name: r1
      condition:
        all:
          - event.request.type == "Delete"
          - event.friend_list.names is select("search",  events.m_0.request.friend_name)
      action:
        print_event:
          pretty: true

but I get

ansible_rulebook.exception.ConditionParsingException: Error parsing: event.friend_list.names is select("search",  events.m_0.request.friend_name). Expected end of text, found '('  (at char 33), (line:1, col:34)

Environment

$ ansible-rulebook --version
__version__ = '0.11.0'

Steps to reproduce

  1. assume the example is in a file named example.yml
  2. run with ansible-rulebook --rulebook example.yml --verbose

Actual results

ansible_rulebook.exception.ConditionParsingException: Error parsing: event.friend_list.names is select("search",  events.m_0.request.friend_name). Expected end of text, found '('  (at char 33), (line:1, col:34)

Expected results

not an error 🙃 since it's copied from the docs

Additional information

I'm possibly doing something wrong, hope these details help to ultimately triage if there is some bugs or it's my fault (in that case sorry I raised this)

@Alex-Izquierdo
Copy link
Contributor

Can you try with the latest version v.0.13.0, v0.11.0 does't support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants