Skip to content

Commit 9d31a08

Browse files
committed
snmp: Only configure snmp_socket when it is required
The easier option would be to switch snmp_socket to undef by default, but that would be a breaking change.
1 parent fab033e commit 9d31a08

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

spec/classes/keepalived_global_defs_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
describe 'without parameters' do
1414
it { is_expected.to create_class('keepalived::global_defs') }
15+
it { is_expected.to contain_concat__fragment('keepalived.conf_globaldefs').without('content' => %(snmp_socket)) }
1516
end
1617

1718
describe 'with parameter notification_email as string' do
@@ -377,7 +378,8 @@
377378
describe 'with parameter snmp_socket' do
378379
let(:params) do
379380
{
380-
snmp_socket: '/path'
381+
snmp_socket: '/path',
382+
enable_snmp_vrrp: true
381383
}
382384
end
383385

templates/globaldefs.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ global_defs {
123123
<%- if @dynamic_interfaces -%>
124124
dynamic_interfaces
125125
<%- end -%>
126-
<%- if @snmp_socket -%>
126+
<%- if @snmp_socket && (@enable_snmp_keepalived || @enable_snmp_vrrp || @enable_snmp_checker || @enable_snmp_rfc || @enable_snmp_rfcv2 || @enable_snmp_rfcv3) -%>
127127
snmp_socket <%= @snmp_socket %>
128128
<%- end -%>
129129
<%- if @vrrp_notify_fifo -%>

0 commit comments

Comments
 (0)