mirror of
https://github.com/ARM-software/devlib.git
synced 2025-02-24 21:47:50 +00:00
cgroups: explicitly check for proper CGroup naming
The shutils run_into support assumes that we always specify a full cgroup path starting by "/". If, by error, we specify a cgroup name without the leading "/" we get an ambiguous message about the cgroup not being found. Since this already happened to me many times, let's add an explicit check about the cgroup name parameter to better info the user about the requirement. Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This commit is contained in:
parent
df61b2a269
commit
68b418dac2
@ -425,6 +425,9 @@ class CgroupsModule(Module):
|
||||
:param cgroup: Name of cgroup to run command into
|
||||
:returns: A command to run `cmdline` into `cgroup`
|
||||
"""
|
||||
if not cgroup.startswith('/'):
|
||||
message = 'cgroup name "{}" must start with "/"'.format(cgroup)
|
||||
raise ValueError(message)
|
||||
return 'CGMOUNT={} {} cgroups_run_into {} {}'\
|
||||
.format(self.cgroup_root, self.target.shutils,
|
||||
cgroup, cmdline)
|
||||
|
Loading…
x
Reference in New Issue
Block a user