return ('set -e\n' + f'{py3} {binary_path} agent --fsid {self.fsid} --daemon-id {self.daemon_id} &\n')
def unit_file(self) -> str:
- return """#generated by cephadm
+ ts = """#generated by cephadm
[Unit]
-Description=cephadm agent for cluster {fsid}
+Description=cephadm agent for cluster {{agent.fsid}}
-PartOf=ceph-{fsid}.target
-Before=ceph-{fsid}.target
+PartOf=ceph-{{agent.fsid}}.target
+Before=ceph-{{agent.fsid}}.target
[Service]
Type=forking
-ExecStart=/bin/bash {data_dir}/unit.run
+ExecStart=/bin/bash {{agent.daemon_dir}}/unit.run
Restart=on-failure
RestartSec=10s
[Install]
-WantedBy=ceph-{fsid}.target
-""".format(
- fsid=self.fsid,
- data_dir=self.daemon_dir
- )
+WantedBy=ceph-{{agent.fsid}}.target
+"""
+ return templating.template_str(self.ctx, ts, agent=self)
def shutdown(self) -> None:
self.stop = True