Skip to content

Commit

Permalink
redis::instance: do not exec cp if source and destination are equal
Browse files Browse the repository at this point in the history
  • Loading branch information
trefzer committed Mar 11, 2024
1 parent e8ca35a commit 4f7246b
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions manifests/instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,6 @@
if $title != 'default' {
$real_service_ensure = $service_ensure == 'running'
$real_service_enable = $service_enable

if $notify_service {
Exec["copy ${redis_file_name_orig} to ${redis_file_name}"] ~> Service["${service_name}.service"]
} else {
Exec["copy ${redis_file_name_orig} to ${redis_file_name}"] -> Service["${service_name}.service"]
}
} else {
$real_service_ensure = undef
$real_service_enable = undef
Expand Down Expand Up @@ -608,10 +602,20 @@
),
}

exec { "copy ${redis_file_name_orig} to ${redis_file_name}":
path => '/usr/bin:/bin',
command => "cp -p ${redis_file_name_orig} ${redis_file_name}",
subscribe => File[$redis_file_name_orig],
refreshonly => true,
if $redis_file_name_orig != $redis_file_name {
exec { "copy ${redis_file_name_orig} to ${redis_file_name}":
path => '/usr/bin:/bin',
command => "cp -p ${redis_file_name_orig} ${redis_file_name}",
subscribe => File[$redis_file_name_orig],
refreshonly => true,
}

if $title != 'default' and $manage_service_file {
if $notify_service {
Exec["copy ${redis_file_name_orig} to ${redis_file_name}"] ~> Service["${service_name}.service"]
} else {
Exec["copy ${redis_file_name_orig} to ${redis_file_name}"] -> Service["${service_name}.service"]
}
}
}
}

0 comments on commit 4f7246b

Please sign in to comment.