-
Notifications
You must be signed in to change notification settings - Fork 0
/
salt-psdiff.py
29 lines (23 loc) · 1004 Bytes
/
salt-psdiff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# salt-minion: Don't include any children of children of salt-minion
# This way we can psdiff (write) through the salt master.
# (Drawback is that we don't see runaway salt-minion children.)
class ProcessFormatterMixin(object):
def has_salt_minion_parent(self, process):
"Including self"
if not process.parent or not process.parent.parent:
return False
if process.parent and process.parent.parent and all(
cmdline == '/usr/bin/python3 /usr/bin/salt-minion'
for cmdline in (
process.cmdline,
process.parent.cmdline,
process.parent.parent.cmdline)):
return True
return self.has_salt_minion_parent(process.parent)
def include(self, process):
inc = super(ProcessFormatterMixin, self).include(process)
if not inc:
return inc
if self.has_salt_minion_parent(process):
return False
return True