Commit a57f9d57 authored by Vincent Pelletier's avatar Vincent Pelletier

Update to latest agent.

Fewer parameters, one more dependency.
parent 6026a297
......@@ -53,46 +53,18 @@ class Recipe(BaseSlapRecipe, GenericSlapRecipe):
configuration_path = os.path.join(self.work_directory, "agent.cfg")
with open(configuration_path, "w") as configuration:
configuration.write(parameter_dict["configuration"])
if "key" in parameter_dict:
key_filepath = os.path.join(self.work_directory, "key")
cert_filepath = os.path.join(self.work_directory, "cert")
with open(key_filepath, "w") as key_file:
key_file.write(parameter_dict['key'])
with open(cert_filepath, "w") as cert_file:
cert_file.write(parameter_dict["cert"])
extra_arguments = "--key_file=%s --cert_file=%s " % (key_filepath,
cert_filepath)
else:
extra_arguments = ""
state_file = self.options["state_file"]
open(state_file, "a").close()
agent_crond_path = os.path.join(crond, "agent")
with open(agent_crond_path, "w") as agent_crond:
agent_crond.write("*/5 * * * * %s -S %s --pidfile=%s --log_directory=%s "
"--state_file=%s --path_file=%s %s%s\n" % (
agent_crond.write("*/5 * * * * %s -S %s --pidfile=%s --log=%s "
"%s 2>&1 > /dev/null\n" % (
self.options["python_binary"],
self.options["agent_binary"],
self.options["pidfile"],
self.options["log_directory"],
state_file,
self.options["path_file"],
extra_arguments,
self.options["log"],
configuration_path,
))
agent_crond.write("1 0 * * * %s -S %s %s\n" % (
self.options["python_binary"],
self.options["report_start"],
configuration_path
))
agent_crond.write("59 23 * * * %s -S %s %s\n" % (
self.options["python_binary"],
self.options["report_stop"],
configuration_path,
))
return self.path_list + [configuration_path, key_filepath, cert_filepath, agent_crond_path]
return self.path_list + [configuration_path, agent_crond_path]
def installCrond(self):
_, ws = self.egg.working_set()
......
......@@ -13,9 +13,7 @@ report_stop = ${buildout:directory}/bin/report_stop
dcrond_binary = ${dcron:location}/sbin/crond
python_binary = ${python2.7:location}/bin/python
pidfile = $${rootdirectory:run}/agent.pid
log_directory = $${rootdirectory:agentlog}
state_file = $${rootdirectory:srv}/state.cfg
path_file = $${rootdirectory:srv}/path.cfg
log = $${rootdirectory:agentlog}/agent.log
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
......
......@@ -26,7 +26,7 @@ eggs = ${instance-recipe:egg}
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg
md5sum = 03243998bea8c2a4a8d20c150dfe1469
md5sum = c7cb98594f394d05baedabe424643f6f
mode = 0644
[eggs]
......@@ -36,6 +36,7 @@ eggs =
${lxml-python:egg}
slapos.cookbook
slapos.toolbox
erp5.util
[lxml-python]
python = python2.7
......@@ -48,7 +49,7 @@ eggs =
${lxml-python:egg}
slapos.core
slapos.cookbook
slapos.toolbox
slapos.toolbox[agent]
[networkcache]
# signature certificates of the following uploaders.
......
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