Without it, load_config simply returns an empty hash for everything,
which in turn makes it so that settings is always empty.
You can see this behavior in a minimal check plugin that attempts to
include utils without also requiring json.
require 'sensu-plugin/check/cli'
require 'sensu-plugin/utils'
class JsonCheck < Sensu::Plugin::Check::CLI
include Sensu::Plugin::Utils
def run
if settings['api'].nil?
critical 'Settings not loaded.'
else
ok settings['api']
end
end
end
Without it,
load_config
simply returns an empty hash for everything, which in turn makes it so thatsettings
is always empty.You can see this behavior in a minimal check plugin that attempts to include
utils
without also requiringjson
.