IsActive returns true if a "wrench" of a certain category and feature should be "dropped in the works".
This function may be called at specific points in the Juju codebase to introduce otherwise hard to induce failure modes for the purposes of manual or CI testing. The "<juju_datadir>/wrench/" directory will be checked for "wrench files" which this function looks for.
Wrench files are line-based, with each line indicating some (mis-)feature to enable for a given part of the code. The should be created on the host where the fault should be triggered.
For example, /var/lib/juju/wrench/machine-agent could contain:
The caller need not worry about errors. Any errors that occur will be logged and false will be returned.
IsEnabled returns true if the wrench feature is turned on globally.
SetEnabled turns the wrench feature on or off globally.
If false is given, all future IsActive calls will unconditionally return false. If true is given, all future IsActive calls will return true for active wrenches.
The previous value for the global wrench enable flag is returned.