Filter out uninstalled systemd units when collecting all units (#1011)
fixes #567 Signed-off-by: Matthew McGinn <mamcgi@gmail.com>
This commit is contained in:
parent
2ae8c1c7a7
commit
140b8b85c3
2 changed files with 4 additions and 2 deletions
|
|
@ -227,7 +227,9 @@ func (c *systemdCollector) getAllUnits() ([]unit, error) {
|
|||
}
|
||||
defer conn.Close()
|
||||
|
||||
allUnits, err := conn.ListUnits()
|
||||
// Filter out any units that are not installed and are pulled in only as dependencies.
|
||||
allUnits, err := conn.ListUnitsFiltered([]string{"loaded"})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue