working plugin_status support

This commit is contained in:
John E. Vincent 2012-01-10 00:32:41 -05:00
parent f78c6a12eb
commit 00384e8148
6 changed files with 21 additions and 5 deletions

View file

@ -162,6 +162,7 @@ module LogStash::Config::Mixin
@logger = LogStash::Logger.new(STDOUT)
is_valid = true
is_valid &&= validate_plugin_status
is_valid &&= validate_check_invalid_parameter_names(params)
is_valid &&= validate_check_required_parameter_names(params)
is_valid &&= validate_check_parameter_values(params)
@ -169,6 +170,22 @@ module LogStash::Config::Mixin
return is_valid
end # def validate
def validate_plugin_status
case @plugin_status
when "experimental"
@logger.warn("Using experimental plugin #{@config_name}. This plugin is untested. Use at your own risk")
when "unstable"
@logger.info("Using unstable plugin #{@config_name}.")
when "stable"
# This is cool.
when nil
raise "#{@config_name} must set a plugin_status"
else
raise "#{@config_name} set an invalid plugin status #{@plugin_status}. Valid values are experimental, unstable and stable"
end
return true
end
def validate_check_invalid_parameter_names(params)
invalid_params = params.keys
# Filter out parameters that match regexp keys.

View file

@ -8,7 +8,7 @@ class LogStash::Filters::Base < LogStash::Plugin
config_name "filter"
plugin_status "unstable"
plugin_status nil
# The type to act on. If a type is given, then this filter will only
# act on messages with the same type. See any input plugin's "type"

View file

@ -9,8 +9,6 @@ class LogStash::Inputs::Base < LogStash::Plugin
include LogStash::Config::Mixin
config_name "input"
plugin_status "unstable"
# Label this input with a type.
# Types are used mainly for filter activation.
#

View file

@ -10,6 +10,8 @@ class LogStash::Inputs::Stdin < LogStash::Inputs::Base
config_name "stdin"
plugin_status "experimental"
public
def register
@host = Socket.gethostname

View file

@ -11,8 +11,6 @@ class LogStash::Outputs::Base < LogStash::Plugin
config_name "output"
plugin_status "unstable"
# The type to act on. If a type is given, then this output will only
# act on messages with the same type. See any input plugin's "type"
# attribute for more.

View file

@ -9,6 +9,7 @@ class LogStash::Outputs::Stdout < LogStash::Outputs::Base
config_name "stdout"
plugin_status "unstable"
# Enable debugging. Tries to pretty-print the entire event object.
config :debug, :validate => :boolean