Remove previously existing pod when replacing it
This commit is contained in:
parent
00bcefccca
commit
eeb63488b5
3
main.py
3
main.py
|
@ -63,8 +63,9 @@ class PodKeeper:
|
||||||
def run(self):
|
def run(self):
|
||||||
os.chdir(self.podhome)
|
os.chdir(self.podhome)
|
||||||
if self.stop_previous and podman.pod.exists(self.podname, _ok_code=[0, 1]).exit_code == 0:
|
if self.stop_previous and podman.pod.exists(self.podname, _ok_code=[0, 1]).exit_code == 0:
|
||||||
print(f"Stopping pod {self.podname}", file=sys.stderr, flush=True)
|
print(f"Replacing existing pod {self.podname}", file=sys.stderr, flush=True)
|
||||||
podman.pod.stop(self.podname)
|
podman.pod.stop(self.podname)
|
||||||
|
podman.pod.rm("-f", self.podname)
|
||||||
|
|
||||||
print(f"Starting pod {self.podname} at {self.last_check}", file=sys.stderr, flush=True)
|
print(f"Starting pod {self.podname} at {self.last_check}", file=sys.stderr, flush=True)
|
||||||
podman.play.kube(self.podyaml, *self.podnet_args)
|
podman.play.kube(self.podyaml, *self.podnet_args)
|
||||||
|
|
Loading…
Reference in a new issue