Commit e630b82a authored by Nicolas Wavrant's avatar Nicolas Wavrant

slaprunner/resilient: generate and store random value using publish_early.

This commit is a fix for 8787716d. It allows to get the random cron string
generated previously through parameters, and not reading manually .installed.cfg.
parent 13626845
...@@ -53,7 +53,7 @@ parts = ...@@ -53,7 +53,7 @@ parts =
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg output = ${buildout:directory}/template.cfg
md5sum = bb7e0bf9959c4437ff1e23e645315ccf md5sum = 62c2ad4b0e2fe3edad27bdb885dee626
mode = 0644 mode = 0644
[template-runner] [template-runner]
...@@ -92,7 +92,7 @@ mode = 0644 ...@@ -92,7 +92,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-runner-export.cfg.in url = ${:_profile_base_location_}/instance-runner-export.cfg.in
output = ${buildout:directory}/instance-runner-export.cfg output = ${buildout:directory}/instance-runner-export.cfg
md5sum = ec92773be8f8a2ad20dc0661d58d7717 md5sum = fb0974c51380eef28d4839318e0ef6e2
mode = 0644 mode = 0644
[template-resilient] [template-resilient]
......
[buildout] [buildout]
extends = template-runner.cfg extends = template-runner.cfg
${pbsready-export:output} pbsready-exporter.cfg
parts += parts +=
nginx_conf nginx_conf
......
[buildout] [buildout]
parts = parts =
template-pbsready-export
switch_softwaretype switch_softwaretype
eggs-directory = ${buildout:eggs-directory} eggs-directory = ${buildout:eggs-directory}
...@@ -58,10 +59,18 @@ context = ...@@ -58,10 +59,18 @@ context =
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
mode = 0644 mode = 0644
[template-pbsready-export]
recipe = slapos.recipe.template:jinja2
template = ${pbsready-export:output}
rendered = $${buildout:directory}/pbsready-exporter.cfg
mode = 640
context =
key slapparameter_dict slap-configuration:configuration
[slap-configuration] [slap-configuration]
recipe = slapos.cookbook:slapconfiguration recipe = slapos.cookbook:slapconfiguration
computer = $${slap-connection:computer-id} computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id} partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url} url = $${slap-connection:server-url}
key = $${slap-connection:key-file} key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file} cert = $${slap-connection:cert-file}
\ No newline at end of file
...@@ -59,7 +59,7 @@ mode = 0644 ...@@ -59,7 +59,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready-export.cfg.in url = ${:_profile_base_location_}/pbsready-export.cfg.in
output = ${buildout:directory}/pbsready-export.cfg output = ${buildout:directory}/pbsready-export.cfg
md5sum = 2f88afa7878ce60a5f8874a002b1a33e md5sum = 7539454fff5b9d271acf06615f333653
mode = 0644 mode = 0644
[template-pull-backup] [template-pull-backup]
......
...@@ -48,6 +48,7 @@ ip = $${notifier:host} ...@@ -48,6 +48,7 @@ ip = $${notifier:host}
[resilient-publish-connection-parameter] [resilient-publish-connection-parameter]
notification-id = http://[$${notifier:host}]:$${notifier:port}/get/$${notifier-exporter:name} notification-id = http://[$${notifier:host}]:$${notifier:port}/get/$${notifier-exporter:name}
-extends = publish-early
[notifier-exporter] [notifier-exporter]
# notifier.notify launches an (exporter) executable, and when finished, # notifier.notify launches an (exporter) executable, and when finished,
...@@ -83,10 +84,22 @@ rendered = $${basedirectory:promises}/exporter-status ...@@ -83,10 +84,22 @@ rendered = $${basedirectory:promises}/exporter-status
<= cron <= cron
recipe = slapos.cookbook:cron.d recipe = slapos.cookbook:cron.d
name = backup name = backup
frequency = $${slap-parameter:resiliency-backup-periodicity} {% set resiliency_backup_periodicity = slapparameter_dict.get('resiliency-backup-periodicity') %}
once-a-day = true {% if resiliency_backup_periodicity %}
frequency = {{ resiliency_backup_periodicity }}
{% else %}
time = $${publish-early:resiliency-backup-periodicity}
{% endif %}
command = ${logrotate:location}/sbin/logrotate -s $${basedirectory:run}/logrotate.status $${logrotate-entry-notifier:output}; $${notifier-exporter:wrapper} --transaction-id `date +%s` command = ${logrotate:location}/sbin/logrotate -s $${basedirectory:run}/logrotate.status $${logrotate-entry-notifier:output}; $${notifier-exporter:wrapper} --transaction-id `date +%s`
[gen-resiliency-backup-periodicity]
recipe = slapos.cookbook:cron.random.time
[publish-early]
recipe = slapos.cookbook:publish-early
-init =
resiliency-backup-periodicity gen-resiliency-backup-periodicity:time
[slap-parameter] [slap-parameter]
# In cron.d format (i.e things like */15 * * * * are accepted). # In cron.d format (i.e things like */15 * * * * are accepted).
resiliency-backup-periodicity = resiliency-backup-periodicity =
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment