From b026588c7f6a6c0511a7f2bff6de19939294adea Mon Sep 17 00:00:00 2001 From: Ramesh Sencha Date: Mon, 29 May 2023 14:08:36 +0530 Subject: [PATCH] (CONT-581) Adding deferred function support for password field --- manifests/init.pp | 4 ++-- spec/classes/apt_spec.rb | 5 +++-- spec/defines/source_spec.rb | 2 +- templates/auth_conf.epp | 5 +++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 7d1baf3fb4..cd408d8f67 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -366,14 +366,14 @@ default => 'present', } - $auth_conf_tmp = epp('apt/auth_conf.epp') + $auth_conf_tmp = stdlib::deferrable_epp('apt/auth_conf.epp', { 'auth_conf_entries' => $auth_conf_entries }) file { '/etc/apt/auth.conf': ensure => $auth_conf_ensure, owner => $auth_conf_owner, group => 'root', mode => '0600', - content => Sensitive("${confheadertmp}${auth_conf_tmp}"), + content => Sensitive($auth_conf_tmp), notify => Class['apt::update'], } } diff --git a/spec/classes/apt_spec.rb b/spec/classes/apt_spec.rb index cb65c1e001..3ce5ba21ca 100644 --- a/spec/classes/apt_spec.rb +++ b/spec/classes/apt_spec.rb @@ -415,10 +415,11 @@ super().merge(manage_auth_conf: true) end - auth_conf_content = "// This file is managed by Puppet. DO NOT EDIT. + auth_conf_content =< -<% $apt::auth_conf_entries.each | $auth_conf_entry | { -%> +// This file is managed by Puppet. DO NOT EDIT. +<% if $auth_conf_entries != [] { -%> +<% $auth_conf_entries.each | $auth_conf_entry | { -%> machine <%= $auth_conf_entry['machine'] %> login <%= $auth_conf_entry['login'] %> password <%= $auth_conf_entry['password'] %> <% } -%> <% } -%>