)
unit_name = 'ceph-%s-crash.service' % fsid
with open(os.path.join(args.unit_dir, unit_name + '.new'), 'w') as f:
- f.write('[Unit]\n'
- 'Description=Ceph crash collector for {fsid}\n'
- 'PartOf=ceph-{fsid}.target\n'
- 'Before=ceph-{fsid}.target\n'
- '\n'
- '[Service]\n'
- 'Type=simple\n'
- 'ExecStartPre=-{container_path} rm ceph-{fsid}-crash\n'
- 'ExecStart={cmd}\n'
- 'ExecStop=-{container_path} stop ceph-{fsid}-crash\n'
- 'Restart=always\n'
- 'RestartSec=10\n'
- 'StartLimitInterval=10min\n'
- 'StartLimitBurst=10\n'
- '\n'
- '[Install]\n'
- 'WantedBy=ceph-{fsid}.target\n'.format(
+ f.write("""# generated by cephadm
+[Unit]
+Description=Ceph crash collector for {fsid}
+PartOf=ceph-{fsid}.target
+Before=ceph-{fsid}.target
+
+[Service]
+Type=simple
+ExecStartPre=-{container_path} rm ceph-{fsid}-crash
+ExecStart={cmd}
+ExecStop=-{container_path} stop ceph-{fsid}-crash
+Restart=always
+RestartSec=10
+StartLimitInterval=10min
+StartLimitBurst=10
+
+[Install]
+WantedBy=ceph-{fsid}.target
+""".format(
container_path=container_path,
fsid=fsid,
cmd=' '.join(c.run_cmd()))
def get_unit_file(fsid, uid, gid):
# type: (str, int, int) -> str
install_path = find_program('install')
- u = """[Unit]
+ u = """# generated by cephadm
+[Unit]
Description=Ceph %i for {fsid}
# According to: