diff --git a/resources/libraries/get_pipelines.rb b/resources/libraries/get_pipelines.rb index c84920d6..d32c02c6 100644 --- a/resources/libraries/get_pipelines.rb +++ b/resources/libraries/get_pipelines.rb @@ -3,7 +3,7 @@ module Helpers def get_pipelines() logstash_pipelines = [] - sensors = node["redborder"]["sensors_info_all"] + sensors = get_sensors_info() namespaces = get_namespaces() main_logstash = determine_main_logstash_node() diff --git a/resources/recipes/configure.rb b/resources/recipes/configure.rb index 2585a38e..17bf7db4 100644 --- a/resources/recipes/configure.rb +++ b/resources/recipes/configure.rb @@ -275,20 +275,18 @@ action (manager_services["pmacct"] ? [:add, :register] : [:remove, :deregister]) end -if node["redborder"]["logstash"]["pipelines"].nil? || node["redborder"]["logstash"]["pipelines"].empty? - service 'logstash' do - action [:disable, :stop] - end -else - logstash_config "Configure logstash" do - cdomain node["redborder"]["cdomain"] - flow_nodes node["redborder"]["all_flow_sensors_info"]["flow-sensor"] - namespaces node["redborder"]["namespaces"] - vault_nodes node["redborder"]["sensors_info_all"]["vault-sensor"] - scanner_nodes node["redborder"]["sensors_info_all"]["scanner-sensor"] - device_nodes node["redborder"]["sensors_info_all"]["device-sensor"] - logstash_pipelines node["redborder"]["logstash"]["pipelines"] - action (manager_services["logstash"] ? [:add, :register] : [:remove, :deregister]) +logstash_config 'Configure logstash' do + cdomain node['redborder']['cdomain'] + flow_nodes node.run_state['all_flow_sensors_info']['flow-sensor'] + namespaces node.run_state['namespaces'] + vault_nodes node.run_state['sensors_info_all']['vault-sensor'] + scanner_nodes node.run_state['sensors_info_all']['scanner-sensor'] + device_nodes node.run_state['sensors_info_all']['device-sensor'] + logstash_pipelines node.default['pipelines'] + if manager_services['logstash'] && node.default['pipelines'] && !node.default['pipelines'].empty? + action [:add, :register] + else + action [:remove, :deregister] end end diff --git a/resources/recipes/prepare_system.rb b/resources/recipes/prepare_system.rb index 0f97e046..cc47f63b 100644 --- a/resources/recipes/prepare_system.rb +++ b/resources/recipes/prepare_system.rb @@ -96,7 +96,7 @@ node.default["redborder"]["all_flow_sensors_info"] = get_all_flow_sensors_info() #get logstash pipelines -node.default["redborder"]["logstash"]["pipelines"] = get_pipelines() +node.default["pipelines"] = get_pipelines() #get namespaces node.default["redborder"]["namespaces"] = get_namespaces