Skip to content

Commit

Permalink
convert template to EPP, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fraenki committed Jul 25, 2023
1 parent 54dbe96 commit 6cbeafc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
4 changes: 3 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
}
-> file { "${thumbor::cfg_path}/thumbor.conf":
ensure => $thumbor::ensure,
content => template('thumbor/thumbor.conf.erb'),
content => epp('thumbor/thumbor.conf.epp', {
_default_config => $_default_config,
}),
owner => $thumbor::user,
group => $thumbor::group,
mode => '0644',
Expand Down
4 changes: 4 additions & 0 deletions spec/default_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ ipaddress: "172.16.254.254"
ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
is_pe: false
macaddress: "AA:AA:AA:AA:AA:AA"

# XXX: This is required for unit tests, because the
# pyvenv defined type requires a valid python version.
python3_version: '3.8.12'
15 changes: 15 additions & 0 deletions templates/thumbor.conf.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<% $_default_config.keys.sort.each |$config_key| { -%>
<% if ($_default_config[$config_key] =~ Hash) { -%>
<%= $config_key.upcase -%> = [
<% $_default_config[$config_key].flatten.each |$value| { -%>
'<%= $value -%>',
<% } -%>
]
<% } elsif ($_default_config[$config_key] =~ Boolean) { -%>
<%= $config_key.upcase %> = <%= $_default_config[$config_key].bool2str.capitalize %>
<% } elsif ($_default_config[$config_key] =~ Integer) { -%>
<%= $config_key.upcase %> = <%= $_default_config[$config_key] %>
<% } elsif ($_default_config[$config_key] =~ String) { -%>
<%= $config_key.upcase %> = '<%= $_default_config[$config_key] %>'
<% } -%>
<% } -%>
15 changes: 0 additions & 15 deletions templates/thumbor.conf.erb

This file was deleted.

0 comments on commit 6cbeafc

Please sign in to comment.