From 0c526936b922b2042fbc4a992583d4868a56b247 Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Sat, 11 Dec 2021 13:56:24 +0100 Subject: [PATCH] redis::instance: do not exec cp if source and destination are equal --- manifests/instance.pp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/manifests/instance.pp b/manifests/instance.pp index d0257e12..9ff7366c 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -355,8 +355,6 @@ if $title != 'default' { $real_service_ensure = $service_ensure == 'running' $real_service_enable = $service_enable - - Exec["cp -p ${redis_file_name_orig} ${redis_file_name}"] ~> Service["${service_name}.service"] } else { $real_service_ensure = undef $real_service_enable = undef @@ -496,9 +494,15 @@ ), } - exec { "cp -p ${redis_file_name_orig} ${redis_file_name}": - path => '/usr/bin:/bin', - subscribe => File[$redis_file_name_orig], - refreshonly => true, + if $redis_file_name_orig != $redis_file_name { + exec { "cp -p ${redis_file_name_orig} ${redis_file_name}": + path => '/usr/bin:/bin', + subscribe => File[$redis_file_name_orig], + refreshonly => true, + } + + if $title != 'default' and $manage_service_file { + Exec["cp -p ${redis_file_name_orig} ${redis_file_name}"] ~> Service["${service_name}.service"] + } } }