Skip to content

Commit 292d79a

Browse files
fix(vrrp_instances) Do not duplicate the 'notify_master' script (#154)
* fix(vrrp_instances) Do not duplicate the 'notify_master' script
1 parent 302929d commit 292d79a

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This file is used to list changes made in each version of the keepalived cookboo
44

55
## Unreleased
66

7+
- Fixed a bug that duplicated the `notify_master` script in a `vrrp_instance`
8+
79
## 6.0.18 - *2024-05-03*
810

911
## 6.0.17 - *2024-05-03*

spec/resources/vrrp_instance_spec.rb

+16-5
Original file line numberDiff line numberDiff line change
@@ -236,24 +236,35 @@ 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+
}
240242
end
241243

242244
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})
245+
is_expected.to render_file(file_name).with_content { |s|
246+
expect(s.scan(%r{notify_master\s/path/to_master\.sh}).size).to eq(1)
247+
}
244248
end
245249

246250
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})
251+
is_expected.to render_file(file_name).with_content { |s|
252+
expect(s.scan(%r{notify_backup\s/path/to_backup\.sh}).size).to eq(1)
253+
}
248254
end
249255

250256
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})
257+
is_expected.to render_file(file_name).with_content { |s|
258+
expect(s.scan(%r{notify_fault\s/path/fault\.sh}).size).to eq(1)
259+
}
252260
end
253261

254262
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})
263+
is_expected.to render_file(file_name).with_content { |s|
264+
expect(s.scan(%r{notify\s/path/notify\.sh}).size).to eq(1)
265+
}
256266
end
267+
257268
it('should render a config file with the smtp_alert set to true') do
258269
is_expected.to render_file(file_name).with_content(/smtp_alert\strue/)
259270
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)