From 0699401332d541c55b1740878423cdb5c02f6dba Mon Sep 17 00:00:00 2001 From: Adam King Date: Thu, 6 Jan 2022 07:42:35 -0500 Subject: [PATCH] cephadm: add unit.meta for agent Signed-off-by: Adam King (cherry picked from commit 6cb56672566650793f76909731ec4857a5c0271a) --- src/cephadm/cephadm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 175348ca2a40b..3a164bbe773e4 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()) -- 2.39.5