Skip to content

Commit

Permalink
Merge pull request #36 from redBorder/task/#16487_wireless_module
Browse files Browse the repository at this point in the history
add rb_wireless in nmsp and location pipeline
  • Loading branch information
JPeraltaNic authored Mar 20, 2024
2 parents 1d56387 + 32d8a4d commit e646707
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
27 changes: 14 additions & 13 deletions resources/providers/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@
mode 0644
ignore_failure true
cookbook "logstash"
variables(:input_topics => ["rb_vault"],
:output_topic => "rb_vault_post",
variables(:output_namespace_topic => "rb_vault_post",
:namespaces => namespaces
)
notifies :restart, "service[logstash]", :delayed
Expand Down Expand Up @@ -360,8 +359,7 @@
mode 0644
ignore_failure true
cookbook "logstash"
variables(:input_topics => ["rb_flow"],
:output_topic => "rb_flow_post",
variables(:output_namespace_topic => "rb_flow_post",
:namespaces => namespaces
)
notifies :restart, "service[logstash]", :delayed
Expand Down Expand Up @@ -409,8 +407,7 @@
mode 0644
ignore_failure true
cookbook "logstash"
variables(:input_topics => ["rb_scanner"],
:output_topic => "rb_scanner_post",
variables(:output_namespace_topic => "rb_scanner_post",
:namespaces => namespaces
)
notifies :restart, "service[logstash]", :delayed
Expand Down Expand Up @@ -454,13 +451,15 @@
end

template "#{pipelines_dir}/nmsp/99_output.conf" do
source "output_kafka.conf.erb"
source "output_kafka_namespace.conf.erb"
owner user
group user
mode 0644
ignore_failure true
cookbook "logstash"
variables(:output_topic => "rb_location")
variables(:output_topics => ["rb_location"],
:output_namespace_topic => "rb_wireless",
:namespaces => namespaces)
notifies :restart, "service[logstash]", :delayed
end
end
Expand Down Expand Up @@ -512,13 +511,15 @@
end

template "#{pipelines_dir}/location/99_output.conf" do
source "output_kafka.conf.erb"
source "output_kafka_namespace.conf.erb"
owner user
group user
mode 0644
ignore_failure true
cookbook "logstash"
variables(:output_topic => "rb_location")
variables(:output_topics => ["rb_location"],
:output_namespace_topic => "rb_wireless",
:namespaces => namespaces)
notifies :restart, "service[logstash]", :delayed
end
end
Expand Down Expand Up @@ -555,7 +556,7 @@
mode 0644
ignore_failure true
cookbook "logstash"
variables(:output_topic => "rb_loc_post",
variables(:output_namespace_topic => "rb_loc_post",
:namespaces => namespaces)
notifies :restart, "service[logstash]", :delayed
end
Expand Down Expand Up @@ -687,7 +688,7 @@
mode 0644
ignore_failure true
cookbook "logstash"
variables(:output_topic => "rb_state_post",
variables(:output_namespace_topic => "rb_state_post",
:namespaces => namespaces)
notifies :restart, "service[logstash]", :delayed
end
Expand Down Expand Up @@ -795,7 +796,7 @@
mode 0644
ignore_failure true
cookbook "logstash"
variables(:output_topic => "rb_monitor_post",
variables(:output_namespace_topic => "rb_monitor_post",
:namespaces => namespaces
)
notifies :restart, "service[logstash]", :delayed
Expand Down
15 changes: 13 additions & 2 deletions resources/templates/default/output_kafka_namespace.conf.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
output {

<% if @output_topics %>
<% @output_topics.each do |output_topic| %>
kafka {
codec => json
topic_id => "<%= output_topic %>"
bootstrap_servers => "kafka.service:9092"
}
<% end %>
<% end %>

if [namespace_uuid]{
<% @namespaces.each do |namespace| %>
if [namespace_uuid] == "<%= namespace %>" {
kafka {
codec => json
topic_id => "<%= @output_topic + "_" + namespace %>"
topic_id => "<%= @output_namespace_topic + "_" + namespace %>"
bootstrap_servers => "kafka.service:9092"
}
}
<% end %>
} else {
kafka {
codec => json
topic_id => "<%= @output_topic %>"
topic_id => "<%= @output_namespace_topic %>"
bootstrap_servers => "kafka.service:9092"
}
}
Expand Down

0 comments on commit e646707

Please sign in to comment.