Class: LogStash::PipelineAction::Reload
- Includes:
- Util::Loggable
- Defined in:
- lib/logstash/pipeline_action/reload.rb
Instance Method Summary collapse
- #execute(agent, pipelines) ⇒ Object
-
#initialize(pipeline_config, metric) ⇒ Reload
constructor
A new instance of Reload.
- #pipeline_id ⇒ Object
Methods included from Util::Loggable
included, #logger, #slow_logger
Methods inherited from Base
#<=>, #execution_priority, #inspect
Constructor Details
#initialize(pipeline_config, metric) ⇒ Reload
Returns a new instance of Reload.
13 14 15 16 |
# File 'lib/logstash/pipeline_action/reload.rb', line 13 def initialize(pipeline_config, metric) @pipeline_config = pipeline_config @metric = metric end |
Instance Method Details
#execute(agent, pipelines) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/logstash/pipeline_action/reload.rb', line 22 def execute(agent, pipelines) old_pipeline = pipelines[pipeline_id] if !old_pipeline.reloadable? return LogStash::ConvergeResult::FailedAction.new("Cannot reload pipeline, because the existing pipeline is not reloadable") end begin pipeline_validator = LogStash::BasePipeline.new(@pipeline_config) rescue => e return LogStash::ConvergeResult::FailedAction.from_exception(e) end if !pipeline_validator.reloadable? return LogStash::ConvergeResult::FailedAction.new("Cannot reload pipeline, because the new pipeline is not reloadable") end logger.info("Reloading pipeline", "pipeline.id" => pipeline_id) status = Stop.new(pipeline_id).execute(agent, pipelines) if status return Create.new(@pipeline_config, @metric).execute(agent, pipelines) else return status end end |
#pipeline_id ⇒ Object
18 19 20 |
# File 'lib/logstash/pipeline_action/reload.rb', line 18 def pipeline_id @pipeline_config.pipeline_id end |