rules icon indicating copy to clipboard operation
rules copied to clipboard

Remove ruleset

Open rogueturnip opened this issue 8 years ago • 3 comments

Me again. I'm wondering if there a way to remove rulesets once they've been added.

What I'd like to do is remove an existing ruleset and replace it with a new one that contains changes.

Thanks!

rogueturnip avatar Sep 26 '17 21:09 rogueturnip

I'm not sure this is the right way to do it. You can write delete function in durableEngine.js in host class.After that you should be include an endpoint in application to call this function and using it via rest api. It will work! But this is not the complete way to do. Wait for @jruizgit give out a solution.Thanks

   that.deleteRuleset = function (rulesetName, complete) {
            try {
                var rules = rulesDirectory[rulesetName];
                if (!rules) {
                    throw 'Ruleset ' + rulesetName + ' not found';
                } else {
                    delete rulesDirectory[rulesetName];
                   // remove hset key in redis db
                    db.hgetall(rulesetName + '!c', function (err, pairKeyValues) {
                        for (var key in pairKeyValues) {
                            db.hdel(rulesetName + '!c', key, redis.print);
                        }
                    });
                    db.hgetall(rulesetName + '!p', function (err, pairKeyValues) {
                        for (var key in pairKeyValues) {
                            db.hdel(rulesetName + '!p', key, redis.print);
                        }
                    });
                    db.hgetall(rulesetName + '!s', function (err, pairKeyValues) {
                        for (var key in pairKeyValues) {
                            db.hdel(rulesetName + '!s', key, redis.print);
                        }
                    });
                    complete(null, true);
                }
            } catch (reason) {
                complete(reason);
            }
        }

chinhls avatar Oct 12 '17 03:10 chinhls

@jruizgit Can you give an update for this. Thanks in advance.

aravindnc-olt avatar Mar 26 '18 08:03 aravindnc-olt

@jruizgit Can you give me a update about the deleteRuleset option ? I need to create/update and delete Ruleset.

rcasanova2018 avatar Jun 22 '21 17:06 rcasanova2018