mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* dconf: Skip processes that disappeared while we inspected them
Fixes #4151
* Update changelogs/fragments/4151-dconf-catch-psutil-nosuchprocess.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 9567c99c9f
)
Co-authored-by: Pavol Babinčák <scroolik@gmail.com>
This commit is contained in:
parent
d97c7aa777
commit
512a46a18c
2 changed files with 7 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "dconf - skip processes that disappeared while we inspected them (https://github.com/ansible-collections/community.general/issues/4151)."
|
|
@ -180,9 +180,9 @@ class DBusWrapper(object):
|
||||||
self.module.debug("Trying to detect existing D-Bus user session for user: %d" % uid)
|
self.module.debug("Trying to detect existing D-Bus user session for user: %d" % uid)
|
||||||
|
|
||||||
for pid in psutil.pids():
|
for pid in psutil.pids():
|
||||||
process = psutil.Process(pid)
|
|
||||||
process_real_uid, dummy, dummy = process.uids()
|
|
||||||
try:
|
try:
|
||||||
|
process = psutil.Process(pid)
|
||||||
|
process_real_uid, dummy, dummy = process.uids()
|
||||||
if process_real_uid == uid and 'DBUS_SESSION_BUS_ADDRESS' in process.environ():
|
if process_real_uid == uid and 'DBUS_SESSION_BUS_ADDRESS' in process.environ():
|
||||||
dbus_session_bus_address_candidate = process.environ()['DBUS_SESSION_BUS_ADDRESS']
|
dbus_session_bus_address_candidate = process.environ()['DBUS_SESSION_BUS_ADDRESS']
|
||||||
self.module.debug("Found D-Bus user session candidate at address: %s" % dbus_session_bus_address_candidate)
|
self.module.debug("Found D-Bus user session candidate at address: %s" % dbus_session_bus_address_candidate)
|
||||||
|
@ -198,6 +198,9 @@ class DBusWrapper(object):
|
||||||
# This can happen with things like SSH sessions etc.
|
# This can happen with things like SSH sessions etc.
|
||||||
except psutil.AccessDenied:
|
except psutil.AccessDenied:
|
||||||
pass
|
pass
|
||||||
|
# Process has disappeared while inspecting it
|
||||||
|
except psutil.NoSuchProcess:
|
||||||
|
pass
|
||||||
|
|
||||||
self.module.debug("Failed to find running D-Bus user session, will use dbus-run-session")
|
self.module.debug("Failed to find running D-Bus user session, will use dbus-run-session")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue