Changeset View
Standalone View
site-modules/profile/manifests/swh/deploy/worker/loader_opam.pp
Show All 15 Lines | ::profile::swh::deploy::worker::instance {'loader_opam': | ||||
private_tmp => $private_tmp, | private_tmp => $private_tmp, | ||||
sentry_name => 'loader_core', | sentry_name => 'loader_core', | ||||
require => [ | require => [ | ||||
Package[$packages], | Package[$packages], | ||||
Class['profile::swh::deploy::worker::loader_package'], | Class['profile::swh::deploy::worker::loader_package'], | ||||
], | ], | ||||
} | } | ||||
$opam_instances = lookup('swh::deploy::worker::opam::instances') | |||||
$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" | ||||
$opam_manage_state_script = "/usr/local/bin/${opam_manage_shared_state}.sh" | $opam_manage_state_script = "/usr/local/bin/${opam_manage_shared_state}.sh" | ||||
# Install more robust opam root folder maintenance tooling | |||||
$default_instance_name = lookup('swh::deploy::worker::opam::default_instance::name') | |||||
$default_instance_url = lookup('swh::deploy::worker::opam::default_instance::url') | |||||
$other_instances = lookup('swh::deploy::worker::opam::instances') | |||||
$template_path = "profile/swh/deploy/loader_opam" | |||||
# Templates uses variables | |||||
# - $user | |||||
# - $group | |||||
# - $default_instance_name | |||||
# - $default_instance_url | |||||
# - $other_instances | |||||
file {$opam_manage_state_script: | file {$opam_manage_state_script: | ||||
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}/${opam_manage_shared_state}.sh.erb"), | ||||
} | } | ||||
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 | ||||
# - $user | # - $user | ||||
# - $group | # - $group | ||||
# - $opam_root | # - $runparts_systemd_directory | ||||
# - $opam_manage_service_name | # - $opam_manage_service_name | ||||
# - $command | # - $opam_manage_state_script | ||||
::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], | ||||
], | ], | ||||
} | } | ||||
################################################################### | |||||
# Clean up old opam root maintenance tooling (to drop once applied) | |||||
################################################################### | |||||
$opam_instances = lookup('swh::deploy::worker::opam::deprecated::instances') | |||||
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_timer_name = "${opam_manage_service_name}.timer" | |||||
# deactivate and drop timer | |||||
olasd: No need for the quoted variable here | |||||
Done Inline Actionsso true ;) ardumont: so true ;) | |||||
::systemd::timer {$opam_manage_timer_name: | |||||
enable => false, | |||||
ensure => absent, | |||||
} | |||||
# drop the service file (deactivated from previous instruction but not removed) | |||||
file {$opam_manage_service_path: | |||||
ensure => absent | |||||
} | |||||
Not Done Inline ActionsA bunch of these aren't being used. I think we need to drop the service unit too. 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… | |||||
} | } | ||||
} | } |
No need for the quoted variable here