Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/swh/deploy/worker/loader_opam.pp
Show All 20 Lines | ::profile::swh::deploy::worker::instance {'loader_opam': | ||||
], | ], | ||||
} | } | ||||
$opam_instances = lookup('swh::deploy::worker::opam::instances') | $opam_instances = lookup('swh::deploy::worker::opam::instances') | ||||
$template_path = "profile/swh/deploy/loader_opam" | $template_path = "profile/swh/deploy/loader_opam" | ||||
$opam_root = lookup('swh::deploy::worker::opam::root_directory') | $opam_root = lookup('swh::deploy::worker::opam::root_directory') | ||||
$opam_manage_shared_state = "opam-manage-shared-state" | $opam_manage_shared_state = "opam-manage-shared-state" | ||||
$default_systemd_path = "/etc/systemd/system" | |||||
# clean up previous versions of the opam maintenance routine | |||||
$opam_manage_state_script = "/usr/local/bin/${opam_manage_shared_state}.sh" | $opam_manage_state_script = "/usr/local/bin/${opam_manage_shared_state}.sh" | ||||
file {$opam_manage_state_script: | file {$opam_manage_state_script: | ||||
ensure => 'absent', | |||||
} | |||||
each ( $opam_instances ) | $instance, $instance_url | { | |||||
$opam_manage_service_name = "${opam_manage_shared_state}-${instance}" | |||||
$opam_manage_service_path = "${default_systemd_path}/${$opam_manage_service_name}.service" | |||||
$opam_manage_shared_state_timer_name = $opam_manage_service_name | |||||
$opam_manage_shared_state_timer_path = "${default_systemd_path}/${opam_manage_shared_state_timer_name}.timer" | |||||
# deactivate timer | |||||
::systemd::timer { "${opam_manage_shared_state_timer_name}.timer": | |||||
enable => false, | |||||
ensure => absent, | |||||
} | |||||
} | |||||
$runparts_systemd_directory = "/run/systemd/system/opam/" | |||||
file {$runparts_systemd_directory: | |||||
ensure => directory, | |||||
owner => $name, | |||||
group => $group, | |||||
mode => '0600', | |||||
} | |||||
$priority = 0 | |||||
each ( $opam_instances ) | $instance, $instance_url | { | |||||
$om_instance_script_name = "${priority}-${opam_manage_shared_state}-${instance}.sh" | |||||
$priority = $priority + 1 | |||||
$om_instance_script_path = "${runparts_systemd_directory}/${$om_instance_script_name}.sh" | |||||
$template_script = $instance ? { | |||||
'opam.ocaml.org' => 'opam-manage-shared-state-default-instance.sh', | |||||
default => 'opam-manage-shared-state-secondary.sh' | |||||
} | |||||
file {$om_instance_script_path: | |||||
ensure => 'file', | ensure => 'file', | ||||
owner => $user, | owner => $user, | ||||
group => $group, | group => $group, | ||||
mode => '0755', | mode => '0755', | ||||
content => template("${template_path}/${opam_manage_shared_state}.sh.erb"), | content => template("${template_path}/${template_script}.erb"), | ||||
require => [ | |||||
Package[$packages], | |||||
File[$runparts_systemd_directory], | |||||
], | |||||
} | |||||
olasd: A bunch of these aren't being used. I think we need to drop the service unit too. | |||||
Done Inline ActionsOh yeah, it's still there because i did initally drop the services myself ^ (plus the next instruction). ardumont: Oh yeah, it's still there because i did initally drop the services myself ^ (plus the next… | |||||
Not Done Inline ActionsAh, so the service removal is implicit when the timer is ensure => absent. Got it. olasd: Ah, so the service removal is implicit when the timer is ensure => absent. Got it. | |||||
Done Inline Actions/me sighs it seems i'm wrong (test plan updated with the last puppet agent --test appliance shows that only the timer is dropped) fixing this and the other remarks you made ardumont: /me sighs
it seems i'm wrong (test plan updated with the last puppet agent --test appliance… | |||||
Done Inline Actionsah no, ok. I did a for-loop on each timer and service for each service. ardumont: ah no, ok.
I know now, my first implementation was wong!
Hence the mixed feeling here.
I did… | |||||
} | } | ||||
each ( $opam_instances ) | $instance, $instance_url | { | |||||
$opam_manage_service_name = "${$opam_manage_shared_state}-${instance}" | |||||
$opam_manage_shared_state_timer_name = "${opam_manage_service_name}.timer" | |||||
# Templates uses variables | # Templates uses variables | ||||
Not Done Inline ActionsNo need for the quoted variable here olasd: No need for the quoted variable here | |||||
Done Inline Actionsso true ;) ardumont: so true ;) | |||||
# - $user | # - $user | ||||
# - $group | # - $group | ||||
# - $opam_root | # - $runparts_systemd_directory | ||||
# - $opam_manage_service_name | # - $opam_manage_service_name | ||||
# - $command | |||||
::systemd::timer { $opam_manage_shared_state_timer_name: | ::systemd::timer { "${opam_manage_shared_state}.timer": | ||||
timer_content => template("${template_path}/${opam_manage_shared_state}.timer.erb"), | timer_content => template("${template_path}/${opam_manage_shared_state}.timer.erb"), | ||||
service_content => template("${template_path}/${opam_manage_shared_state}.service.erb"), | service_content => template("${template_path}/${opam_manage_shared_state}.service.erb"), | ||||
enable => true, | enable => true, | ||||
require => [ | require => [ | ||||
Package[$packages], | Package[$packages], | ||||
File[$opam_manage_state_script], | File[$runparts_systemd_directory], | ||||
], | ], | ||||
} | } | ||||
} | |||||
} | } |
A bunch of these aren't being used. I think we need to drop the service unit too.