Don't use defined

The 'defined' function is always true for defined variables
even when the value is undef. This makes the conditionals useless
and this patch makes the module to test value instead.

Change-Id: I9228d84e02b485f089fce84ea12ca8afba903a61
This commit is contained in:
Martin Magr 2020-02-03 16:53:23 +01:00
parent 6468651b27
commit 53665f2393
1 changed files with 3 additions and 3 deletions

View File

@ -58,7 +58,7 @@ class tripleo::profile::base::logging::rsyslog (
# other choice than using hiera currently.
$rsyslog_confdir = hiera('rsyslog::confdir', '/etc/rsyslog.d')
if defined('$elasticsearch_tls_ca_cert') {
if $elasticsearch_tls_ca_cert {
$cacert_path = "${rsyslog_confdir}/es-ca-cert.crt"
$cacert_conf = {'tls.cacert' => $cacert_path}
@ -72,7 +72,7 @@ class tripleo::profile::base::logging::rsyslog (
$esconf1 = $elasticsearch
}
if defined('$elasticsearch_tls_client_cert') {
if $elasticsearch_tls_client_cert {
$clientcert_path = "${rsyslog_confdir}/es-client-cert.pem"
$clientcert_conf = {'tls.mycert' => $clientcert_path}
@ -86,7 +86,7 @@ class tripleo::profile::base::logging::rsyslog (
$esconf2 = $esconf1
}
if defined('$elasticsearch_tls_client_key') {
if $elasticsearch_tls_client_key {
$clientkey_path = "${rsyslog_confdir}/es-client-key.pem"
$clientkey_conf = {'tls.myprivkey' => $clientkey_path}