coreos/go-systemd

Missing non-"unit" properties (e.g. service)

phemmer opened this issue · 1 comments

For service (and presumably other) unit types, some property updates are being missed when using SetPropertiesSubscriber. This is happening because they are being sent across D-Bus with interface org.freedesktop.systemd1.Service, and the code is discarding everything other than org.freedesktop.systemd1.Unit:

case "org.freedesktop.DBus.Properties.PropertiesChanged":
if signal.Body[0].(string) == "org.freedesktop.systemd1.Unit" {
unitPath = signal.Path
if len(signal.Body) >= 2 {
if changed, ok := signal.Body[1].(map[string]dbus.Variant); ok {
c.sendPropertiesUpdate(unitPath, changed)
}
}
}
}

For example, here's a snippet from dbus-monitor:

signal time=1638238697.632552 sender=:1.0 -> destination=(null destination) serial=1589575 path=/org/freedesktop/systemd1/unit/test_4060_2eservice; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.systemd1.Service"
   array [
      dict entry(
         string "MainPID"
         variant             uint32 0
      )
      dict entry(
         string "ControlPID"
         variant             uint32 0
      )
      dict entry(
         string "StatusText"
         variant             string ""
      )
      dict entry(
         string "StatusErrno"
         variant             int32 0
      )
      dict entry(
         string "Result"
         variant             string "success"
      )

I'm not sure how you would prefer to handle this. Personally I'm inclined to remove the check on the interface. Let all properties get sent to the registered handler regardless of the interface. An Interface field could be added to the PropertiesUpdate struct to pass it along.

Closing. Have decided not to use go-systemd as it would require too many changes to work well.