Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-7551

CLI: ansible-rulebook doesn't support non alphanumeric keys at the root level

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • None
    • Ansible Integration
    • None
    • 2023 Week 36-38 (from Sep 4)
    • NEW
    • NEW
    • ---
    • ---

    Description

      We support non-alphanumeric keys in rules but only at the non root level
      e.g.
      event["a/b/c"] == "down" (root level a/b/c key) fails
      event.data["a/b/c"] == "down" (data is the root level and a/b/c is the next level) works

      The event is just a mnemonic that is stripped out before we send the AST to the Drools engine. The event doesn't exist in the payload coming from external sources
      <what is happening>

      The first error that we see is
      2023-09-13 09:31:19,309 - ansible_rulebook.cli - ERROR - Terminating Invalid identifier : event["a/b/c"] Should start with event., events.,fact., facts. or vars.

      Once this is fixed in ansible_rulebook by making it aware of the square bracket notation we get a Drools error
      2023-09-12 16:48:52,847 - ansible_rulebook.cli - ERROR - Terminating java.lang.NullPointerException: Cannot invoke "org.antlr.v4.runtime.Token.getStopIndex()" because the return value of "org.antlr.v4.runtime.ParserRuleContext.getStop()" is null

      Steps to Reproduce

      Use the attached rulebook and run the ansible-rulebook

      Actual Behavior

      Failure in ansible-rulebook
      Failure in drools

      Expected Behavior

      We should be able to support the dot notation or the square bracket notation at the root and non root levels when defining a condition

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            mkanoor Madhu Kanoor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: