cloud-init/backport-util-Support-Idle-process-state-in-get_proc_ppid-163.patch
Lv Ying eb8e747f39 cloud-init:backport upstream patches
Reference:
7136109df5
f51c352e6c
668a68fe57

Signed-off-by: Lv Ying <lvying6@huawei.com>
2023-07-30 09:17:45 +08:00

37 lines
1.2 KiB
Diff

From 631eecf82a4af3ec46b6f2a257849a80a2299bee Mon Sep 17 00:00:00 2001
From: Brett Holman <brett.holman@canonical.com>
Date: Fri, 5 Aug 2022 22:28:53 +0200
Subject: [PATCH 2/3] util: Support Idle process state in get_proc_ppid()
(#1637)
Reference:https://github.com/canonical/cloud-init/commit/f51c352e6c6a7d05a61308c188450a1b818eac45
Conflict:NA
---
cloudinit/util.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 9e530db..58f6e27 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -2763,9 +2763,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
--
2.40.0