From 29548ab46bcd69d11cef106530556f362c4be802 Mon Sep 17 00:00:00 2001 From: Adam King Date: Wed, 14 Feb 2024 12:02:09 -0500 Subject: [PATCH] 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) --- src/cephadm/cephadm.py | 7 +++++++ 1 file changed, 7 insertions(+) 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')] -- 2.39.5