summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Holman <brett.holman@canonical.com>2022-08-05 22:28:53 +0200
committerGitHub <noreply@github.com>2022-08-05 14:28:53 -0600
commitf51c352e6c6a7d05a61308c188450a1b818eac45 (patch)
tree76c49e078256fc05538f9e78b949061365918408
parentb36618b83cc2aa003ea00272d7044f3c53848c49 (diff)
downloadcloud-init-git-f51c352e6c6a7d05a61308c188450a1b818eac45.tar.gz
util: Support Idle process state in get_proc_ppid() (#1637)
-rw-r--r--cloudinit/util.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 515476c6..30480c92 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -2896,9 +2896,15 @@ def get_proc_ppid(pid):
contents = load_file("/proc/%s/stat" % pid, quiet=True)
if contents:
# see proc.5 for format
- m = re.search(r"^\d+ \(.+\) [RSDZTtWXxKWP] (\d+)", str(contents))
+ m = re.search(r"^\d+ \(.+\) [RSDZTtWXxKPI] (\d+)", str(contents))
if m:
ppid = int(m.group(1))
+ else:
+ LOG.warning(
+ "Unable to match parent pid of process pid=%s input: %s",
+ pid,
+ contents,
+ )
except IOError as e:
LOG.warning("Failed to load /proc/%s/stat. %s", pid, e)
return ppid