Skip to content

Commit c70e42e

Browse files
committed
Add Config.OnInactive and fixed actions
1 parent 1631b9e commit c70e42e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

cmd/sd-dbus-hooks/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ func (c *Config) getUnit(name string) (Unit, error) {
2020
}
2121
}
2222

23-
return Unit{}, fmt.Errorf("unit %v not found in config\n", name)
23+
return Unit{}, fmt.Errorf("unit %v not found in config", name)
2424
}
2525

2626
type Unit struct {
2727
Name string `yaml:"name"`
2828
OnActive []string `yaml:"on_active"`
29+
OnInctive []string `yaml:"on_inactive"`
2930
OnFailed []string `yaml:"on_failed"`
3031
BlockedBy []string `yaml:"blocked_by"`
3132
}

cmd/sd-dbus-hooks/subscribe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ func (s *subscriber) processEvent(u *dbus.UnitStatus) {
5656
case "active":
5757
s.execute(unit.OnActive, u)
5858
case "inactive":
59-
s.execute(unit.OnActive, u)
59+
s.execute(unit.OnInctive, u)
6060
case "failed":
61-
s.execute(unit.OnActive, u)
61+
s.execute(unit.OnFailed, u)
6262
}
6363
}
6464

0 commit comments

Comments
 (0)