]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: exporter: use os.path.realpath(__file__)
authorSebastian Wagner <sebastian.wagner@suse.com>
Fri, 26 Feb 2021 10:20:35 +0000 (11:20 +0100)
committerSage Weil <sage@newdream.net>
Tue, 16 Mar 2021 12:56:18 +0000 (07:56 -0500)
Because we now always have a script on the remote hosts.

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
(cherry picked from commit 470d79bee5101e7d4c11378450591f55e6ede4cc)

src/cephadm/cephadm
src/cephadm/tests/test_cephadm.py

index 7ced316fe6fdbe6db84a5777070b97784ba4b62d..6f21fa002d7f9c7b869418494ce33964108c294c 100755 (executable)
@@ -6628,7 +6628,6 @@ class CephadmDaemon():
 
     daemon_type = 'cephadm-exporter'
     default_port = 9443
-    bin_name = 'cephadm'
     key_name = 'key'
     crt_name = 'crt'
     token_name = 'token'
@@ -6723,11 +6722,9 @@ class CephadmDaemon():
 
     @property
     def binary_path(self):
-        return os.path.join(
-            self.ctx.data_dir,
-            self.fsid,
-            CephadmDaemon.bin_name
-        )
+        path = os.path.realpath(__file__)
+        assert os.path.isfile(path)
+        return path
 
     def _handle_thread_exception(self, exc, thread_type):
         e_msg = f'{exc.__class__.__name__} exception: {str(exc)}'
index 707af0a55bcadd8043d13fa9d5fc5bd3f7e1ff2b..d77cc2a1c7e78810b878d9406dedd776a94452fc 100644 (file)
@@ -619,13 +619,10 @@ iMN28C2bKGao5UHvdER1rGy7
         assert exporter.unit_run
         lines = exporter.unit_run.split('\n')
         assert len(lines) == 2
-        assert "/var/lib/ceph/foobar/cephadm exporter --fsid foobar --id test --port 9443 &" in lines[1]
+        assert "cephadm exporter --fsid foobar --id test --port 9443 &" in lines[1]
 
     def test_binary_path(self, exporter):
-        # fsid = foobar
-        args = cd._parse_args([])
-        cd.args = args
-        assert exporter.binary_path == "/var/lib/ceph/foobar/cephadm"
+        assert os.path.isfile(exporter.binary_path)
 
     def test_systemd_unit(self, exporter):
         assert exporter.unit_file