Skip to content

Commit

Permalink
apply review notes. Change $:: to $. Use facts[]. Change erb template…
Browse files Browse the repository at this point in the history
… to epp
  • Loading branch information
MaxFedotov committed Sep 3, 2018
1 parent 1275536 commit 5305e3c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 59 deletions.
4 changes: 3 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

$config_settings = $proxysql::config_settings
$proxy_config_file = $proxysql::proxy_config_file
$split_config = $proxysql::split_config

if $proxysql::manage_config_file {
file { 'proxysql-config-file':
ensure => file,
Expand All @@ -22,7 +24,7 @@
file { 'proxysql-proxy-config-file':
ensure => file,
path => $proxysql::proxy_config_file,
content => template('proxysql/proxysql_proxy.cnf.erb'),
content => epp('proxysql/proxysql_proxy.cnf.epp', { config_settings => $config_settings }),
mode => '0640',
owner => $proxysql::sys_owner,
group => $proxysql::sys_group,
Expand Down
4 changes: 2 additions & 2 deletions templates/proxysql.cnf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ end
<%
else
-%>
<% if scope.lookupvar('::proxysql::split_config') == false -%>
<% if @split_config == false -%>
<%= k %> = (
<%
v.each do |ki, vi|
Expand All @@ -67,6 +67,6 @@ end
end
-%>

<% if scope.lookupvar('::proxysql::split_config') == true -%>
<% if @split_config == true -%>
@include "<%= @proxy_config_file %>"
<% end -%>
18 changes: 18 additions & 0 deletions templates/proxysql_proxy.cnf.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<%- | Hash $config_settings | -%>
<% $config_settings.each |$key, $value| { -%>
<% if $key == "mysql_servers" { -%>
<%= $key %> = (<% if $value != {} { -%><%= $value %><% } -%>)
<% } -%>
<% if $key == "mysql_users" { -%>
<%= $key %> = (<% if $value != {} { -%><%= $value %><% } -%>)
<% } -%>
<% if $key == "mysql_query_rules" { -%>
<%= $key %> = (<% if $value != {} { -%><%= $value %><% } -%>)
<% } -%>
<% if $key == "scheduler" { -%>
<%= $key %> = (<% if $value != {} { -%><%= $value %><% } -%>)
<% } -%>
<% if $key == "mysql_replication_hostgroups" { -%>
<%= $key %> = (<% if $value != {} { -%><%= $value %><% } -%>)
<% } -%>
<% } -%>
56 changes: 0 additions & 56 deletions templates/proxysql_proxy.cnf.erb

This file was deleted.

0 comments on commit 5305e3c

Please sign in to comment.