From: Adam King Date: Wed, 14 Feb 2024 17:02:09 +0000 (-0500) Subject: cephadm: rm podman-auth.json if removing last cluster X-Git-Tag: v18.2.4~187^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F56105%2Fhead;p=ceph.git cephadm: rm podman-auth.json if removing last cluster We have points in rm-cluster where we check that there are no other clusters on the host. If that is the case, we can also clear /etc/ceph/podman-auth.json which gets written out when we log in to a registry while using podman Fixes: https://tracker.ceph.com/issues/64433 Signed-off-by: Adam King (cherry picked from commit d203a97e1bf1e06433365ea38e3ab2b6430cefff) --- diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 99e0ac740a0..da5b8fe1bdd 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -8218,6 +8218,13 @@ def _rm_cluster(ctx: CephadmContext, keep_logs: bool, zap_osds: bool) -> None: for fname in glob(f'{ctx.log_dir}/cephadm.log*'): os.remove(fname) + try: + Path('/etc/ceph/podman-auth.json').unlink() + except FileNotFoundError: + pass + except Exception as e: + logger.debug(f'Could not remove podman-auth.json: {e}') + # rm sysctl settings sysctl_dirs: List[Path] = [Path(ctx.sysctl_dir), Path('/usr/lib/sysctl.d')]