From: Adam King Date: Thu, 6 Jan 2022 12:42:35 +0000 (-0500) Subject: cephadm: add unit.meta for agent X-Git-Tag: v17.1.0~31^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0699401332d541c55b1740878423cdb5c02f6dba;p=ceph.git cephadm: add unit.meta for agent Signed-off-by: Adam King (cherry picked from commit 6cb56672566650793f76909731ec4857a5c0271a) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 175348ca2a4..3a164bbe773 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -3787,6 +3787,12 @@ class CephadmAgent(): with open(os.open(os.path.join(self.daemon_dir, 'unit.run'), os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f: f.write(self.unit_run()) + meta: Dict[str, Any] = {} + if 'meta_json' in self.ctx and self.ctx.meta_json: + meta = json.loads(self.ctx.meta_json) or {} + with open(os.open(os.path.join(self.daemon_dir, 'unit.meta'), os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f: + f.write(json.dumps(meta, indent=4) + '\n') + unit_file_path = os.path.join(self.ctx.unit_dir, self.unit_name()) with open(os.open(unit_file_path + '.new', os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f: f.write(self.unit_file())