Skip to content
Snippets Groups Projects
Verified Commit aaaca103 authored by Karel Koci's avatar Karel Koci :metal:
Browse files

nsfarm/lxd/utils: fix PermissionError on container clean

The user might not have ability to send signal to that process but we
only check if process exists (is running) and not having ability means
that process is running.
parent 627357cf
Branches
Tags
1 merge request!37nsfarm/lxd/utils: fix PermissionError on container clean
......@@ -79,7 +79,9 @@ def clean_containers(dry_run=False):
try:
os.kill(pid, 0)
except OSError as err:
if (err.errno != 3): # 3 == ESRCH: No such process
if err.errno == 1: # 1 == EPERM: Process is running under different user
continue
if err.errno != 3: # 3 == ESRCH: No such process
raise
removed.append(cont.name)
if not dry_run:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment