Remove ruleset
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!
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);
}
}
@jruizgit Can you give an update for this. Thanks in advance.
@jruizgit Can you give me a update about the deleteRuleset option ? I need to create/update and delete Ruleset.