Fix debian errors
All checks were successful
/ go-test (push) Successful in 9m50s

This commit is contained in:
Melora Hugues 2024-12-07 18:13:41 +01:00
parent 3688dc01b7
commit 05ed62fda1
Signed by: faercol
SSH key fingerprint: SHA256:lzUKsKDIw1w0bcLnoBu84oYJOnLmi7SeKetszpyDCFY
2 changed files with 5 additions and 3 deletions

View file

@ -33,7 +33,8 @@ func (c *AptCollector) updateInstalledPackages() error {
return fmt.Errorf("failed to run apt list: %w (%s)", err, string(out)) return fmt.Errorf("failed to run apt list: %w (%s)", err, string(out))
} }
c.installedPackages = len(strings.Split(strings.TrimSpace(string(out)), "\n")) // remove the unstable interface warning
c.installedPackages = len(strings.Split(strings.TrimSpace(string(out)), "\n")) - 3
return nil return nil
} }
@ -50,7 +51,8 @@ func (c *AptCollector) updatePendingUpdates() error {
return fmt.Errorf("failed to run apt list: %w (%s)", err, string(out)) return fmt.Errorf("failed to run apt list: %w (%s)", err, string(out))
} }
c.pendingUpdates = len(strings.Split(strings.TrimSpace(string(out)), "\n")) // remove the unstable interface warning
c.pendingUpdates = len(strings.Split(strings.TrimSpace(string(out)), "\n")) - 3
return nil return nil
} }

View file

@ -41,7 +41,7 @@ func (c *SystemdCollector) Collect() interface{} {
} }
func (c *SystemdCollector) getServicesStatus() ([]serviceStatus, error) { func (c *SystemdCollector) getServicesStatus() ([]serviceStatus, error) {
out, err := exec.Command("/sbin/systemctl", "list-units", "--output", "json").CombinedOutput() out, err := exec.Command("/usr/bin/systemctl", "list-units", "--output", "json").CombinedOutput()
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to run systemd command: %w", err) return nil, fmt.Errorf("failed to run systemd command: %w", err)
} }