Skip to content

Commit 345f900

Browse files
committed
fix(deisctl): add custom error message for global units.
1 parent dc5a3a5 commit 345f900

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

deisctl/backend/fleet/journal.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ func runJournal(name string) (exit int) {
2525
fmt.Fprintf(os.Stderr, "Error retrieving Unit %s: %v", name, err)
2626
return 1
2727
}
28+
if suToGlobal(*u) {
29+
fmt.Fprintf(os.Stderr, "Unable to get journal for global unit %s. Check the logs on the host using journalctl.\n", name)
30+
return 1
31+
}
2832
if u == nil {
2933
fmt.Fprintf(os.Stderr, "Unit %s does not exist.\n", name)
3034
return 1

deisctl/backend/fleet/status.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ func (c *FleetClient) Status(target string) (err error) {
2121
// printUnitStatus displays the systemd status for a given unit
2222
func printUnitStatus(name string) int {
2323
u, err := cAPI.Unit(name)
24+
if suToGlobal(*u) {
25+
fmt.Fprintf(os.Stderr, "Unable to get status for global unit %s. Check the status on the host using systemctl.\n", name)
26+
return 1
27+
}
2428
if err != nil {
2529
fmt.Fprintf(os.Stderr, "Error retrieving Unit %s: %v", name, err)
2630
return 1

0 commit comments

Comments
 (0)