Skip to content

Commit

Permalink
Merge branch 'brdude-multipleNetworksPerCommunityString' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
razorsedge committed Oct 15, 2015
2 parents 9b0927c + a056f13 commit f50f1fb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/classes/snmp_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,16 @@
])
end
end

describe 'ro_network => [ "127.0.0.1", "192.168.1.1/24", ]' do
let(:params) {{ :ro_network => [ '127.0.0.1', '192.168.1.1/24', ] }}
it 'should contain File[snmpd.conf] with contents "127.0.0.1" and "192.168.1.1/24"' do
verify_contents(catalogue, 'snmpd.conf', [
'rocommunity public 127.0.0.1',
'rocommunity public 192.168.1.1/24',
])
end
end
end

context 'on a supported osfamily (Debian), custom parameters' do
Expand Down
24 changes: 24 additions & 0 deletions templates/snmpd.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,41 @@ agentaddress <%= @agentaddress.join(',') %>
# ------------------------------------------------------------------------------
# Traditional Access Control
<% if @ro_community and (@ro_community.size > 0) -%>
<% if (@ro_network.is_a?(Array)) and (@ro_network.count > 0) -%>
<% @ro_network.each do |ro_net| -%>
rocommunity <%= @ro_community %> <%= ro_net %>
<% end -%>
<% else -%>
rocommunity <%= @ro_community %> <%= @ro_network %>
<% end -%>
<% end -%>
<% if @ro_community6 and (@ro_community6.size > 0) -%>
<% if (@ro_network6.is_a?(Array)) and (@ro_network6.count > 0) -%>
<% @ro_network6.each do |ro_net6| -%>
rocommunity6 <%= @ro_community6 %> <%= ro_net6 %>
<% end -%>
<% else -%>
rocommunity6 <%= @ro_community6 %> <%= @ro_network6 %>
<% end -%>
<% end -%>
<% if @rw_community and (@rw_community.size > 0) -%>
<% if (@rw_network.is_a?(Array)) and (@rw_network.count > 0) -%>
<% @rw_network.each do |rw_net| -%>
rwcommunity <%= @rw_community %> <%= rw_net %>
<% end -%>
<% else -%>
rwcommunity <%= @rw_community %> <%= @rw_network %>
<% end -%>
<% end -%>
<% if @rw_community6 and (@rw_community6.size > 0) -%>
<% if (@rw_network6.is_a?(Array)) and (@rw_network6.count > 0) -%>
<% @rw_network6.each do |rw_net6| -%>
rwcommunity6 <%= @rw_community6 %> <%= rw_net6 %>
<% end -%>
<% else -%>
rwcommunity6 <%= @rw_community6 %> <%= @rw_network6 %>
<% end -%>
<% end -%>

# ------------------------------------------------------------------------------
# VACM Configuration
Expand Down

0 comments on commit f50f1fb

Please sign in to comment.