From: Sage Weil Date: Sun, 9 Feb 2020 00:17:34 +0000 (-0600) Subject: cephadm: clean up unit string syntax a bit X-Git-Tag: v15.1.1~486^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=278cd54afb3ac6a1c5169388adb50bbc4adf3169;p=ceph-ci.git cephadm: clean up unit string syntax a bit Signed-off-by: Sage Weil --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 8e3fb8bb95f..92e31d5dfc5 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -1404,23 +1404,25 @@ def deploy_crash(fsid, uid, gid, config, keyring): ) 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())) @@ -1433,7 +1435,8 @@ def deploy_crash(fsid, uid, gid, config, keyring): 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: