]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: rm podman-auth.json if removing last cluster 56105/head
authorAdam King <adking@redhat.com>
Wed, 14 Feb 2024 17:02:09 +0000 (12:02 -0500)
committerAdam King <adking@redhat.com>
Sun, 10 Mar 2024 20:58:07 +0000 (16:58 -0400)
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 <adking@redhat.com>
(cherry picked from commit d203a97e1bf1e06433365ea38e3ab2b6430cefff)

src/cephadm/cephadm.py

index 99e0ac740a0eb76512fb018b98fbcbd9cd4f08d6..da5b8fe1bddcbfd4ec403cb0d18d0509f3042fb4 100755 (executable)
@@ -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')]