Skip to content

Commit

Permalink
Add Config.OnInactive and fixed actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tierpod committed Apr 2, 2018
1 parent 1631b9e commit c70e42e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/sd-dbus-hooks/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ func (c *Config) getUnit(name string) (Unit, error) {
}
}

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

type Unit struct {
Name string `yaml:"name"`
OnActive []string `yaml:"on_active"`
OnInctive []string `yaml:"on_inactive"`
OnFailed []string `yaml:"on_failed"`
BlockedBy []string `yaml:"blocked_by"`
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/sd-dbus-hooks/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func (s *subscriber) processEvent(u *dbus.UnitStatus) {
case "active":
s.execute(unit.OnActive, u)
case "inactive":
s.execute(unit.OnActive, u)
s.execute(unit.OnInctive, u)
case "failed":
s.execute(unit.OnActive, u)
s.execute(unit.OnFailed, u)
}
}

Expand Down

0 comments on commit c70e42e

Please sign in to comment.