api: Don't return an error when no cgroups are enabled
Don't return an error, ECGROUPNOTEXIST (50002), from cgroup_get_cgroup()
when no controllers are enabled in a cgroup v2 cgroup.
Simple reproducer:
sudo mkdir -p /sys/fs/cgroup/foo/bar
#!/usr/bin/env python3
from libcgroup import Cgroup, Version
cg = Cgroup('foo/bar', Version.CGROUP_V2)
cg.get()
print(cg)
Prior to this change, the above python code returned ECGROUPNOTEXIST in
the cg.get() line. Now it successfully completes, but no controllers
are populated.
Reported-by: Justin Israel <justinisrael@gmail.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit
7c99c8a385c5946c8873313b8c99cc9b5cf25bfd)