]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: add unit.meta for agent
authorAdam King <adking@redhat.com>
Thu, 6 Jan 2022 12:42:35 +0000 (07:42 -0500)
committerAdam King <adking@redhat.com>
Fri, 28 Jan 2022 16:23:51 +0000 (11:23 -0500)
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 6cb56672566650793f76909731ec4857a5c0271a)

src/cephadm/cephadm

index 175348ca2a40b2834b1128e4b9d35d7acd766498..3a164bbe773e4f1e3cb0a047b9fb490b01ffbb40 100755 (executable)
@@ -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())