exscript icon indicating copy to clipboard operation
exscript copied to clipboard

"exit" keyword to exit a template without marking it as "fail"?

Open lathspell opened this issue 7 years ago • 1 comments

Imagine a script that queries the current firmware version and then decides if a patch has to be installed or not. It would be handy if a template could "graceful" exist if the patch is already detected on that host. Using "fail" marks this host as having had a problem. Using "if" to skip the rest of the script works but looks ugly. Would a "return"/"exit" keyword make sense?

lathspell avatar Jul 25 '18 11:07 lathspell

I agree that would be useful. One way to implement it quickly might be to introduce a new exception type in the template processor (ExitException or something), and catch that to handle it gracefully. Otherwise the template's functions / scopes need to gain awareness of the running state of the program, which is probably a bigger change.

knipknap avatar Aug 28 '18 17:08 knipknap