juju: github.com/juju/juju/wrench Index | Files

package wrench

import "github.com/juju/juju/wrench"


Package Files

wrench.go wrench_nix.go

func IsActive Uses

func IsActive(category, feature string) bool

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.

func IsEnabled Uses

func IsEnabled() bool

IsEnabled returns true if the wrench feature is turned on globally.

func SetEnabled Uses

func SetEnabled(next bool) bool

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.

Package wrench imports 10 packages (graph) and is imported by 131 packages. Updated 2019-12-24. Refresh now. Tools for package owners.