Browse Source

Merge "Catch FileNotFoundError when listing namespace PIDs"

changes/84/693484/2
Zuul 3 weeks ago
parent
commit
7a2ef88686
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      neutron/privileged/agent/linux/ip_lib.py

+ 2
- 2
neutron/privileged/agent/linux/ip_lib.py View File

@@ -216,7 +216,7 @@ def list_ns_pids(namespace):
try:
ns_path = os.path.join(NETNS_RUN_DIR, namespace)
ns_inode = os.stat(ns_path).st_ino
except OSError:
except (OSError, FileNotFoundError):
return ns_pids

for pid in os.listdir('/proc'):
@@ -226,7 +226,7 @@ def list_ns_pids(namespace):
pid_path = os.path.join('/proc', pid, 'ns', 'net')
if os.stat(pid_path).st_ino == ns_inode:
ns_pids.append(int(pid))
except OSError:
except (OSError, FileNotFoundError):
continue

return ns_pids

Loading…
Cancel
Save