Skip to content

Commit

Permalink
fix(vrrp_instances) Do not duplicate the 'notify_master' script (#154)
Browse files Browse the repository at this point in the history
* fix(vrrp_instances) Do not duplicate the 'notify_master' script
  • Loading branch information
john-scalingo authored Jul 15, 2024
1 parent 302929d commit 292d79a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the keepalived cookboo

## Unreleased

- Fixed a bug that duplicated the `notify_master` script in a `vrrp_instance`

## 6.0.18 - *2024-05-03*

## 6.0.17 - *2024-05-03*
Expand Down
21 changes: 16 additions & 5 deletions spec/resources/vrrp_instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,35 @@ def vrrp_instance_file_name(name)
end

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

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

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

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

it('should render a config file with the notify correctly') do
is_expected.to render_file(file_name).with_content(%r{notify\s/path/notify\.sh})
is_expected.to render_file(file_name).with_content { |s|
expect(s.scan(%r{notify\s/path/notify\.sh}).size).to eq(1)
}
end

it('should render a config file with the smtp_alert set to true') do
is_expected.to render_file(file_name).with_content(/smtp_alert\strue/)
end
Expand Down
3 changes: 0 additions & 3 deletions templates/vrrp_instance.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ vrrp_instance <%= @instance_name %> {
<% if @notify_master %>
notify_master <%= @notify_master.to_s %>
<% end %>
<% if @notify_master %>
notify_master <%= @notify_master.to_s %>
<% end %>
<% if @notify_backup %>
notify_backup <%= @notify_backup.to_s %>
<% end %>
Expand Down

0 comments on commit 292d79a

Please sign in to comment.