Skip to content

Commit f3a51ce

Browse files
committed
redis::instance: do not exec cp if source and destination are equal
1 parent 4a8d781 commit f3a51ce

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

manifests/instance.pp

+10-6
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,6 @@
355355
if $title != 'default' {
356356
$real_service_ensure = $service_ensure == 'running'
357357
$real_service_enable = $service_enable
358-
359-
Exec["cp -p ${redis_file_name_orig} ${redis_file_name}"] ~> Service["${service_name}.service"]
360358
} else {
361359
$real_service_ensure = undef
362360
$real_service_enable = undef
@@ -496,9 +494,15 @@
496494
),
497495
}
498496

499-
exec { "cp -p ${redis_file_name_orig} ${redis_file_name}":
500-
path => '/usr/bin:/bin',
501-
subscribe => File[$redis_file_name_orig],
502-
refreshonly => true,
497+
if $redis_file_name_orig != $redis_file_name {
498+
exec { "cp -p ${redis_file_name_orig} ${redis_file_name}":
499+
path => '/usr/bin:/bin',
500+
subscribe => File[$redis_file_name_orig],
501+
refreshonly => true,
502+
}
503+
504+
if $title != 'default' and $manage_service_file {
505+
Exec["cp -p ${redis_file_name_orig} ${redis_file_name}"] ~> Service["${service_name}.service"]
506+
}
503507
}
504508
}

0 commit comments

Comments
 (0)