-
Notifications
You must be signed in to change notification settings - Fork 113
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
EDA does not like either slashes or dashes within the condition path #60
Comments
@burnyd In the source plugin are you getting array data? Currently we don't support array in conditions. In the source plugin you should be able to morph the data the way you want to check in the rules. |
Yes, I am getting a python dictionary for the data referenced within the issue. So the output pushed into the python async queue would look like this. {"name":"sub1","timestamp":1670273612118710138,"tags":{"interface_name":"Ethernet1","source":"172.20.20.3","subscription-name":"sub1"},"values":{"/interfaces/interface/state/admin-status":"UP"}} If I can understand what you are saying is I need to edit the source plugin so I am only returning the value of a string of "UP" and that the return value cannot be an array? |
@burnyd I was thinking you would have multiple interfaces in that case you would have to use indexing e.g. interface[0], interface[1] that is currently not supported. In your example it looks like the key has embedded slashes and that might be throwing it off. I will look into it |
Okay please let me know. Otherwise, It looks I have to replace strings with "/" or "-" with underscores. |
@burnyd The identifiers used for keys needs to follow the rules for Ansible variable names and it can only contain I think in your case you would have to convert the / to underscore |
When you say convert the / to underscore you are referring to the actual source EDA plugin? So have that use python string replace for "/" to "" and within the condition where I am keying use "" ? Just want to make sure I am clear on this. |
You can use event filters for this: https://github.com/benthomasson/ci-cd-demo/blob/main/event_filters/dashes_to_underscores.py See how to use them here: https://github.com/benthomasson/ci-cd-demo/blob/main/github-ci-cd-rules.yml
|
Version of ansible-rulebook
I am trying to develop a new EDA source plugin. I need to key off data coming from a pub/sub bus. Some sample data will look as the following
The very last portion is what I need to key off of the values key
The condition portion of the rule-book looks as follows.
Resulting in the following error.
I have tried dotted notation, brackets and also vars all within the same error message. Either I can key off of this value or if there is a way to be able to check to see if the word DOWN is within that array would work as well. But generally speaking it does not like slashes or dashes.
The text was updated successfully, but these errors were encountered: