From 1b0c50b5496feee4daf7582e643d6e8a43a2dbd2 Mon Sep 17 00:00:00 2001 From: Martynas Buivys Date: Fri, 3 May 2019 15:41:43 +0300 Subject: [PATCH] dbus: Introduce GetAllProperties() for fetching all systemd unit properties --- dbus/methods.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dbus/methods.go b/dbus/methods.go index 5f2790ac..5859583e 100644 --- a/dbus/methods.go +++ b/dbus/methods.go @@ -197,6 +197,12 @@ func (c *Conn) GetUnitPathProperties(path dbus.ObjectPath) (map[string]interface return c.getProperties(path, "org.freedesktop.systemd1.Unit") } +// GetAllProperties takes the (unescaped) unit name and returns all of its dbus object properties. +func (c *Conn) GetAllProperties(unit string) (map[string]interface{}, error) { + path := unitPath(unit) + return c.getProperties(path, "") +} + func (c *Conn) getProperty(unit string, dbusInterface string, propertyName string) (*Property, error) { var err error var prop dbus.Variant