]> git-server-git.apps.pok.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)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 4 Mar 2021 17:27:53 +0000 (18:27 +0100)
Because we now always have a script on the remote hosts.

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/cephadm/cephadm
src/cephadm/tests/test_cephadm.py

index 5f9443645ef2966fc4649c6ddf12fd5fc6d2c52d..a47872d33dd234c047155f077df4ec28c7bd874e 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