Make the Karaf shell a more useful scripting environment

We’ve added enough Karaf shell commands over the past few releases that it’s become increasingly common for even casually CLI-savvy users to interact with OpenNMS through this medium. We could do even better, though, by making key modifications to a few of our existing commands, and creating some new ones.

The Karaf shell is actually a fairly decent scripting host, with support for neat concepts like lists and closures. Our commands so far have not shown consistent awareness of the shell-command interface contract, though, and some of them have behaviors (e.g. throwing exceptions in situations where the underlying failures are sometimes expected) that make them ill-suited for use in closures or pipelines.

I propose to go through our existing commands and make them better scripting citizens, as well as to implement a small set of new commands that produce lists or maps as output. As a stretch goal, this effort might produce some totally new commands that scratch various itches – I have a mental list, which suggests others do too.

Unfortunately we have solved the problem by removing the script which comes with Karaf and could help here, see NMS-9728.