question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to remove rules by name

See original GitHub issue

I’m building a service using this engine. The users are able to add and remove rules whenever they want. I’m having troubles on the removal process.

Every time a user adds a rule, I create a new rule using let rule = new engine.Rule(options). With that rule I do two things:

1.- Save the JSON to the filesystem, so every time I need to reload the service I could recreate the rules. 2.- Add the rule to then engine.

This works great. The problem that I have is when I try to remove a rule. For that process the user gives me the name of the rule an I do the following:

1.- Find in the filesystem the .json file that correspond to the name the user gives me. 2.- Create a json object from that file: let ruleFromJson = JSON.parse(fs.readFileSync(file, { encoding: 'UTF-8' })) 3.- Create a Rule from that object: let rule = new engine.Rule(ruleFromJson); 4.- Remove the rule: engine.removeRule(rule);

After doing that if I run the engine passing a fact that match the deleted rule, the engine still throw onSuccess with that rule.

What I’m doing wrong?

Versions:

  • Node: 10.16.0
  • JSON Rules Engine: 4.0.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
CacheControlcommented, Jun 5, 2021

Now available in 6.1.X

1reaction
ghostcommented, Sep 23, 2019

@CacheControl , you’re right. The engine method removeRule() return false. As you do in the quick fix I manually remove the rule. We’ll wait until this feature to come out. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delete a rule - Microsoft Support
You might decide that you no longer want to use a rule you have created. To delete a rule, do the following: Click...
Read more >
How to delete private check out rule, when i am not able to ...
4. Run activity Rule-.RMActionDeleteCheckedOut. You must select correct thread name which contains the checked out rule page and copy exisiting ...
Read more >
Why can't I delete an AWS Config rule?
Open the AWS Organizations console using the management account for the organization. In Account name, choose the AWS account. In Policies, ...
Read more >
Add, Change, or Delete Rules - WatchGuard Technologies
Add Rules in Fireware Web UI · In the Rule Name text box, type the name of the rule. · For the Match...
Read more >
How to stop the creation of Auto-Added Access Rules and ...
Scroll down to FIREWALL SETTINGS and you will be able to find the option to “Enable the ability to remove and fully edit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found