1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 10:10:46 +00:00

cgroups: Raise RuntimeError in freeze if no freezer controller

Without this patch, this will result in an error due to trying to call
`.cgroup` on None. Making this a RuntimeError instaed means that a) you
get a more useful error message and b) you can catch the exception
without blanket `except Exception as e`.
This commit is contained in:
Brendan Jackman 2016-11-25 11:56:42 +00:00
parent 290af6619d
commit c89f712923

View File

@ -448,6 +448,8 @@ class CgroupsModule(Module):
# Create Freezer CGroup # Create Freezer CGroup
freezer = self.controller('freezer') freezer = self.controller('freezer')
if freezer is None:
raise RuntimeError('freezer cgroup controller not present')
freezer_cg = freezer.cgroup('/DEVLIB_FREEZER') freezer_cg = freezer.cgroup('/DEVLIB_FREEZER')
thawed_cg = freezer.cgroup('/') thawed_cg = freezer.cgroup('/')