From: Sebastian Wagner Date: Fri, 26 Feb 2021 10:20:35 +0000 (+0100) Subject: cephadm: exporter: use os.path.realpath(__file__) X-Git-Tag: v17.1.0~2665^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=470d79bee5101e7d4c11378450591f55e6ede4cc;p=ceph.git cephadm: exporter: use os.path.realpath(__file__) Because we now always have a script on the remote hosts. Signed-off-by: Sebastian Wagner --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 5f9443645ef29..a47872d33dd23 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -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)}' diff --git a/src/cephadm/tests/test_cephadm.py b/src/cephadm/tests/test_cephadm.py index 707af0a55bcad..d77cc2a1c7e78 100644 --- a/src/cephadm/tests/test_cephadm.py +++ b/src/cephadm/tests/test_cephadm.py @@ -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