From: Tom Hromatka Date: Wed, 24 Mar 2021 18:56:23 +0000 (+0000) Subject: cgroup.py: Add support for lssubsys X-Git-Tag: v2.0.3~11^2^2~19^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff011aadc9bcc1907037d662d5606ddc617cee99;p=thirdparty%2Flibcgroup.git cgroup.py: Add support for lssubsys Add support for lssubsys to the Cgroup class. Signed-off-by: Tom Hromatka --- diff --git a/ftests/cgroup.py b/ftests/cgroup.py index 50a8856f..a3f394e2 100644 --- a/ftests/cgroup.py +++ b/ftests/cgroup.py @@ -655,3 +655,38 @@ class Cgroup(object): return config.container.run(cmd) else: return Run.run(cmd) + + @staticmethod + def lssubsys(config, ls_all=False, cghelp=False, hierarchies=False, + mount_points=False, all_mount_points=False): + cmd = list() + + cmd.append(Cgroup.build_cmd_path('lssubsys')) + + if ls_all: + cmd.append('-a') + + if cghelp: + cmd.append('-h') + + if hierarchies: + cmd.append('-i') + + if mount_points: + cmd.append('-m') + + if all_mount_points: + cmd.append('-M') + + if config.args.container: + ret = config.container.run(cmd) + else: + try: + ret = Run.run(cmd) + except RunError as re: + if "profiling" in re.stderr: + ret = re.stdout + else: + raise re + + return ret