Skip to content

Commit e995bb9

Browse files
sjenriquezgmmeyer
authored andcommitted
[docker] parse subsystem
1 parent 508f994 commit e995bb9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

utils/dockerutil.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,17 @@ def _tags_match_patterns(self, tags, filters):
334334
return True
335335
return False
336336

337+
@classmethod
338+
def _parse_subsystem(cls, line):
339+
i = line[2].rfind('docker')
340+
return line[2][i:]
341+
337342
@classmethod
338343
def find_cgroup_from_proc(cls, mountpoints, pid, subsys, docker_root='/'):
339344
proc_path = os.path.join(docker_root, 'proc', str(pid), 'cgroup')
340345
with open(proc_path, 'r') as fp:
341346
lines = map(lambda x: x.split(':'), fp.read().splitlines())
342-
subsystems = dict(zip(map(lambda x: x[1], lines), map(lambda x: x[2] if x[2][0] != '/' else x[2][1:], lines)))
347+
subsystems = dict(zip(map(lambda x: x[1], lines), map(cls._parse_subsystem, lines)))
343348

344349
if subsys not in subsystems and subsys == 'cpuacct':
345350
for form in "{},cpu", "cpu,{}":

0 commit comments

Comments
 (0)