Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@
# @param service_enable
# Patroni service enable property
# @param custom_pip_provider
# @param tags
# Boolean to use tag feature of patroni
# @param tags_parameters
# Refer to `tags` setting
# Use custom pip path when installing pip packages
class patroni (

Expand Down Expand Up @@ -366,6 +370,10 @@
String $watchdog_device = '/dev/watchdog',
Integer $watchdog_safety_margin = 5,

# Tags settings
Boolean $tags = false,
Hash $tags_parameters = {},

# Module Specific Settings
Boolean $manage_postgresql = true,
Optional[String] $postgresql_version = undef,
Expand Down
15 changes: 15 additions & 0 deletions spec/classes/patroni_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,21 @@
end
end

context 'tags => true' do
let(:params) { { 'scope' => 'testscope', 'tags' => true } }

it 'has valid config' do
content = catalogue.resource('file', 'patroni_config').send(:parameters)[:content]
config = YAML.safe_load(content)
expected = {
'tags' => {
'nofailover' => 'true',
},
}
expect(config).to include(expected)
end
end

context 'manage_postgresql => false' do
let(:params) { { 'scope' => 'testscope', 'manage_postgresql' => false } }

Expand Down
8 changes: 8 additions & 0 deletions templates/postgresql.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,11 @@ consul:
service_check_interval: <%= @consul_service_check_interval %>
<% end -%>
<% end -%>
<%- if @tags -%>
<% unless @tags_parameters.empty? -%>
tags:
<% @tags_parameters.each do |name,val| -%>
<%= name -%>: <%= val %>
<% end -%>
<% end -%>
<%- end -%>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the trailing whitespace here?