Change systemd unit filtering (#1083)
* Change systemd unit filtering Get all units from systemd and filter in Go. * Improves compatibility with older versions of systemd. * Improve debugging by printing when units pass the filter. * Remove extraneous newlines from log messages. Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
parent
4672ea1671
commit
0fdc089187
3 changed files with 12 additions and 9 deletions
|
|
@ -126,7 +126,8 @@ func TestSystemdIgnoreFilterDefaultKeepsAll(t *testing.T) {
|
|||
fixtures := getUnitListFixtures()
|
||||
collector := c.(*systemdCollector)
|
||||
filtered := filterUnits(fixtures[0], collector.unitWhitelistPattern, collector.unitBlacklistPattern)
|
||||
if len(filtered) != len(fixtures[0]) {
|
||||
// Adjust fixtures by 3 "not-found" units.
|
||||
if len(filtered) != len(fixtures[0])-3 {
|
||||
t.Error("Default filters removed units")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue