Merge pull request #37 from vmarmol/allow-not-found

Don't fail getting stats of unknown hierarchies.
This commit is contained in:
Victor Marmol 2014-06-20 08:45:56 -07:00
commit 36663b1ee2
1 changed files with 5 additions and 4 deletions

View File

@ -57,12 +57,13 @@ func GetStats(c *cgroups.Cgroup) (*cgroups.Stats, error) {
d, err := getCgroupData(c, 0)
if err != nil {
return nil, err
return nil, fmt.Errorf("getting CgroupData %s", err)
}
for _, sys := range subsystems {
if err := sys.GetStats(d, stats); err != nil {
return nil, err
for sysName, sys := range subsystems {
// Don't fail if a cgroup hierarchy was not found.
if err := sys.GetStats(d, stats); err != nil && err != cgroups.ErrNotFound {
return nil, fmt.Errorf("getting stats for system %q %s", sysName, err)
}
}