Use docker for etcd existence check (root-owned dir)
The etcd directory is root-owned, so shell test -f fails. Use docker with volume mount to check file existence. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>fix-kind-relative-volume-paths
parent
0213ec5d7d
commit
be334ca39f
|
|
@ -126,8 +126,12 @@ def _clean_etcd_keeping_certs(etcd_path: str) -> bool:
|
||||||
Returns True if cleanup succeeded, False if no action needed or failed.
|
Returns True if cleanup succeeded, False if no action needed or failed.
|
||||||
"""
|
"""
|
||||||
db_path = Path(etcd_path) / "member" / "snap" / "db"
|
db_path = Path(etcd_path) / "member" / "snap" / "db"
|
||||||
# Check existence - etcd dir is often root-owned so use shell test
|
# Check existence using docker since etcd dir is root-owned
|
||||||
check_result = subprocess.run(f"test -f {db_path}", shell=True, capture_output=True)
|
check_cmd = (
|
||||||
|
f"docker run --rm -v {etcd_path}:/etcd:ro alpine:3.19 "
|
||||||
|
"test -f /etcd/member/snap/db"
|
||||||
|
)
|
||||||
|
check_result = subprocess.run(check_cmd, shell=True, capture_output=True)
|
||||||
if check_result.returncode != 0:
|
if check_result.returncode != 0:
|
||||||
if opts.o.debug:
|
if opts.o.debug:
|
||||||
print(f"No etcd snapshot at {db_path}, skipping cleanup")
|
print(f"No etcd snapshot at {db_path}, skipping cleanup")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue