refactor list of license_types

DRY up the list of license types as there were 10 places that listed the types explicitly

Fixes #11407
This commit is contained in:
Joao Duarte 2019-12-09 16:50:10 +00:00 committed by João Duarte
parent 557e287966
commit 3294a4be61
8 changed files with 12 additions and 15 deletions

View file

@ -11,7 +11,6 @@ module LogStash module Monitoring
include LogStash::LicenseChecker::Licensed
include LogStash::Helpers::ElasticsearchOptions
include LogStash::Util::Loggable
VALID_LICENSES = %w(basic trial standard gold platinum)
FEATURE = 'monitoring'
def initialize(pipeline_config, agent)
@ -68,7 +67,7 @@ module LogStash module Monitoring
:log_level => :error,
:log_message => 'Monitoring is not available: License information is currently unavailable. Please make sure you have added your production elasticsearch connection info in the xpack.monitoring.elasticsearch settings.'
}
elsif !xpack_info.license_one_of?(VALID_LICENSES)
elsif !xpack_info.license_one_of?(::LogStash::LicenseChecker::LICENSE_TYPES)
{
:state => :error,
:log_level => :error,