From 9cca6c31f604d015edef57921103e9230394a5dd Mon Sep 17 00:00:00 2001 From: Aleksandar Markicevic Date: Tue, 12 Feb 2019 16:51:35 +0100 Subject: [PATCH 1/2] Fixed varibale name and code style --- manifests/resource/upstream/member.pp | 4 ++-- templates/upstream/upstream_member.epp | 4 ++-- types/upstreammember.pp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/resource/upstream/member.pp b/manifests/resource/upstream/member.pp index 075f564a1..b23775a38 100644 --- a/manifests/resource/upstream/member.pp +++ b/manifests/resource/upstream/member.pp @@ -75,7 +75,7 @@ default => "${nginx::config::conf_dir}/conf.d", } - $_server = ($server =~ Pattern[/^unix:\/([^\/\0]+\/*)*$/]) ? { + $real_server = ($server =~ Pattern[/^unix:\/([^\/\0]+\/*)*$/]) ? { true => $server, false => "${server}:${port}", } @@ -84,7 +84,7 @@ target => "${conf_dir}/${upstream}-upstream.conf", order => 40, content => epp('nginx/upstream/upstream_member.epp', { - _server => $_server, + real_server => $real_server, backup => $backup, comment => $comment, fail_timeout => $fail_timeout, diff --git a/templates/upstream/upstream_member.epp b/templates/upstream/upstream_member.epp index 4bfed2db7..af094062a 100644 --- a/templates/upstream/upstream_member.epp +++ b/templates/upstream/upstream_member.epp @@ -1,4 +1,4 @@ -<%- | $_server, +<%- | $real_server, Boolean $backup = false, Optional[String[1]] $comment = undef, Optional[Nginx::Time] $fail_timeout = undef, @@ -13,7 +13,7 @@ Optional[Enum['drain','down']] $state = undef, Optional[Integer[1]] $weight = undef, | -%> - server <%= $_server -%> + server <%= $real_server -%> <%- if $params_prepend { %> <%= $params_prepend %><% } -%> <%- if $state { %> <%= $state %><% } -%> <%- if $weight { %> weight=<%= $weight %><% } -%> diff --git a/types/upstreammember.pp b/types/upstreammember.pp index 10dcc42e8..8534f13a2 100644 --- a/types/upstreammember.pp +++ b/types/upstreammember.pp @@ -1,5 +1,5 @@ type Nginx::UpstreamMember = Struct[{ - server => Optional[Nginx::UpstreamMemberServer], + server => Optional[Nginx::UpstreamMemberServer], port => Optional[Stdlib::Port], weight => Optional[Integer[1]], max_conns => Optional[Integer[1]], From 5907c4c5f4571df13b310a67d17f1cb95b1946bc Mon Sep 17 00:00:00 2001 From: Aleksandar Markicevic Date: Tue, 12 Feb 2019 17:27:19 +0100 Subject: [PATCH 2/2] refactor fix --- manifests/resource/upstream/member.pp | 4 ++-- templates/upstream/upstream_member.epp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/resource/upstream/member.pp b/manifests/resource/upstream/member.pp index 9d53fc460..5be5dfad0 100644 --- a/manifests/resource/upstream/member.pp +++ b/manifests/resource/upstream/member.pp @@ -75,7 +75,7 @@ default => "${nginx::config::conf_dir}/conf.d", } - $real_server = $server ? { + $_server = $server ? { Pattern[/^unix:\/([^\/\0]+\/*)*$/] => $server, Stdlib::IP::Address::V6 => "[${server}]:${port}", #lint:ignore:unquoted_string_in_selector default => "${server}:${port}", @@ -85,7 +85,7 @@ target => "${conf_dir}/${upstream}-upstream.conf", order => 40, content => epp('nginx/upstream/upstream_member.epp', { - real_server => $real_server, + server => $_server, backup => $backup, comment => $comment, fail_timeout => $fail_timeout, diff --git a/templates/upstream/upstream_member.epp b/templates/upstream/upstream_member.epp index af094062a..d4511cf40 100644 --- a/templates/upstream/upstream_member.epp +++ b/templates/upstream/upstream_member.epp @@ -1,4 +1,4 @@ -<%- | $real_server, +<%- | $server, Boolean $backup = false, Optional[String[1]] $comment = undef, Optional[Nginx::Time] $fail_timeout = undef, @@ -13,7 +13,7 @@ Optional[Enum['drain','down']] $state = undef, Optional[Integer[1]] $weight = undef, | -%> - server <%= $real_server -%> + server <%= $server -%> <%- if $params_prepend { %> <%= $params_prepend %><% } -%> <%- if $state { %> <%= $state %><% } -%> <%- if $weight { %> weight=<%= $weight %><% } -%>