Skip to content

Commit e59eed6

Browse files
committed
fix(vrrp_instances) Do not duplicate the 'notify_master' script
1 parent 302929d commit e59eed6

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

spec/resources/vrrp_instance_spec.rb

+17-5
Original file line numberDiff line numberDiff line change
@@ -236,24 +236,36 @@ def vrrp_instance_file_name(name)
236236
end
237237

238238
it('should render a config file with the notify_stop correctly') do
239-
is_expected.to render_file(file_name).with_content(%r{notify_stop\s/path/to_stop\.sh})
239+
is_expected.to render_file(file_name).with_content{|s|
240+
expect(s.scan(%r{notify_stop\s/path/to_stop\.sh}).size).to eq(1)
241+
}
242+
240243
end
241244

242245
it('should render a config file with the notify_master correctly') do
243-
is_expected.to render_file(file_name).with_content(%r{notify_master\s/path/to_master\.sh})
246+
is_expected.to render_file(file_name).with_content{|s|
247+
expect(s.scan(%r{notify_master\s/path/to_master\.sh}).size).to eq(1)
248+
}
244249
end
245250

246251
it('should render a config file with the notify_backup correctly') do
247-
is_expected.to render_file(file_name).with_content(%r{notify_backup\s/path/to_backup\.sh})
252+
is_expected.to render_file(file_name).with_content{|s|
253+
expect(s.scan(%r{notify_backup\s/path/to_backup\.sh}).size).to eq(1)
254+
}
248255
end
249256

250257
it('should render a config file with the notify_fault correctly') do
251-
is_expected.to render_file(file_name).with_content(%r{notify_fault\s/path/fault\.sh})
258+
is_expected.to render_file(file_name).with_content{|s|
259+
expect(s.scan(%r{notify_fault\s/path/fault\.sh}).size).to eq(1)
260+
}
252261
end
253262

254263
it('should render a config file with the notify correctly') do
255-
is_expected.to render_file(file_name).with_content(%r{notify\s/path/notify\.sh})
264+
is_expected.to render_file(file_name).with_content{|s|
265+
expect(s.scan(%r{notify\s/path/notify\.sh}).size).to eq(1)
266+
}
256267
end
268+
257269
it('should render a config file with the smtp_alert set to true') do
258270
is_expected.to render_file(file_name).with_content(/smtp_alert\strue/)
259271
end

templates/vrrp_instance.conf.erb

-3
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ vrrp_instance <%= @instance_name %> {
124124
<% if @notify_master %>
125125
notify_master <%= @notify_master.to_s %>
126126
<% end %>
127-
<% if @notify_master %>
128-
notify_master <%= @notify_master.to_s %>
129-
<% end %>
130127
<% if @notify_backup %>
131128
notify_backup <%= @notify_backup.to_s %>
132129
<% end %>

0 commit comments

Comments
 (0)