Openwhisk: Support deleting "active" rules

Created on 24 Nov 2016  路  6Comments  路  Source: apache/openwhisk

Rules must be disabled before being deleted.
If I write tools or scripts to manage my openwhisk projects, using a client library, I end up having to always write an extra call to disable every rule I want to remove.
Would it be possible to modify the API to relax this constraint?

controller enhancement

Most helpful comment

@rabbah npm openwhisk actually didn't manage this behaviour for you, it would return the fail response if you tried to delete an active rule.

All 6 comments

I think it's a good safety measure to be explicit and have the extra step by default.
Maybe have an option -force for those that want to it in one http call

Isn't it what "--disable" flag is already doing?

$ wsk rule delete --help
delete rule
Usage:
wsk rule delete RULE_NAME [flags]

Flags:
--disable automatically disable rule before deleting it

Having a force option would work. 馃憤

The CLI also has to send two API requests to support that flag.
https://github.com/openwhisk/openwhisk/blob/master/tools/cli/go-whisk-cli/commands/rule.go#L389

This protection on the rule isn't much protection at all: one can delete the trigger or the action leaving the rule in a bad state.

What's perhaps necessary is a sealing operation on a package instead, that prevent accidentally deleting, updating, or disabling all assets in the sealed package (note, I'm inventing a new concept, sealing, and allowing rules, triggers, and actions to be nested in a package).

So I've implemented this - the impetus was seeing the horrendous code one has to write to programmatically deal with deleting or updating a rule.

@jthomas npm openwhisk requires an update?

@rabbah npm openwhisk actually didn't manage this behaviour for you, it would return the fail response if you tried to delete an active rule.

Was this page helpful?
0 / 5 - 0 ratings