Skip to content

Commit

Permalink
Add wal 0.9.3+ parametes to the config only if influxdb version > 0.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dgolja committed Sep 13, 2015
1 parent 27238b1 commit 0368412
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
26 changes: 26 additions & 0 deletions spec/classes/config_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,30 @@
it { is_expected.to contain_file('/etc/opt/influxdb/influxdb.conf').with_content(/check-interval = "20m"/) }
end

context 'add 0.9.3 specific wal options' do
let (:params) {{ :version => '0.9.3' }}
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '12.04',
}
end
it { is_expected.to contain_file('/etc/opt/influxdb/influxdb.conf') }
it { is_expected.to contain_file('/etc/opt/influxdb/influxdb.conf').with_content(/wal-dir = "\/var\/opt\/influxdb\/wal"/) }
end

context 'without 0.9.3 options if version installed < 0.9.3' do
let (:params) {{ :version => '0.9.2' }}
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '12.04',
}
end
it { is_expected.to contain_file('/etc/opt/influxdb/influxdb.conf') }
it { is_expected.to contain_file('/etc/opt/influxdb/influxdb.conf').without_content(/wal-dir = "\/var\/opt\/influxdb\/wal"/) }
end

end
4 changes: 3 additions & 1 deletion templates/influxdb.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ hostname = "<%= @hostname -%>"
[data]
dir = "<%= @data_dir -%>"
max-wal-size = <%= @max_wal_size %>
wal-dir = "<%= @wal_dir -%>"
wal-flush-interval = "<%= @wal_flush_interval -%>"
wal-partition-flush-delay = "<%= @wal_partition_flush_delay -%>"
<%- if scope.function_versioncmp([@version, '0.9.3']) >= 0 -%>
wal-dir = "<%= @wal_dir -%>"
wal-enable-logging = <%= @wal_enable_logging %>
wal-ready-series-size = <%= @wal_ready_series_size %>
wal-compaction-threshold = <%= @wal_compaction_threshold %>
wal-max-series-size = <%= @wal_max_series_size %>
wal-flush-cold-interval = "<%= @wal_flush_cold_interval %>"
wal-partition-size-threshold = <%= @wal_partition_size_threshold %>
<% end -%>

[cluster]
shard-writer-timeout = "<%= @shard_writer_timeout -%>"
Expand Down

0 comments on commit 0368412

Please sign in to comment.