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`.
diff --git a/devlib/module/cgroups.py b/devlib/module/cgroups.py
index e4b387c..dd514d9 100644
--- a/devlib/module/cgroups.py
+++ b/devlib/module/cgroups.py
@@ -448,6 +448,8 @@
# Create Freezer CGroup
freezer = self.controller('freezer')
+ if freezer is None:
+ raise RuntimeError('freezer cgroup controller not present')
freezer_cg = freezer.cgroup('/DEVLIB_FREEZER')
thawed_cg = freezer.cgroup('/')