Skip to content

Commit 8abd78f

Browse files
committed
Merge pull request #28 from bcwaldon/explicit-systemd-iface
fix(iface): Explicitly set systemd interface
2 parents b6bbed6 + 5bb4202 commit 8abd78f

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

dbus/methods.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,42 +84,42 @@ func (c *Conn) runJob(job string, args ...interface{}) (string, error) {
8484
// has been removed too. skipped indicates that a job was skipped because it
8585
// didn't apply to the units current state.
8686
func (c *Conn) StartUnit(name string, mode string) (string, error) {
87-
return c.runJob("StartUnit", name, mode)
87+
return c.runJob("org.freedesktop.systemd1.Manager.StartUnit", name, mode)
8888
}
8989

9090
// StopUnit is similar to StartUnit but stops the specified unit rather
9191
// than starting it.
9292
func (c *Conn) StopUnit(name string, mode string) (string, error) {
93-
return c.runJob("StopUnit", name, mode)
93+
return c.runJob("org.freedesktop.systemd1.Manager.StopUnit", name, mode)
9494
}
9595

9696
// ReloadUnit reloads a unit. Reloading is done only if the unit is already running and fails otherwise.
9797
func (c *Conn) ReloadUnit(name string, mode string) (string, error) {
98-
return c.runJob("ReloadUnit", name, mode)
98+
return c.runJob("org.freedesktop.systemd1.Manager.ReloadUnit", name, mode)
9999
}
100100

101101
// RestartUnit restarts a service. If a service is restarted that isn't
102102
// running it will be started.
103103
func (c *Conn) RestartUnit(name string, mode string) (string, error) {
104-
return c.runJob("RestartUnit", name, mode)
104+
return c.runJob("org.freedesktop.systemd1.Manager.RestartUnit", name, mode)
105105
}
106106

107107
// TryRestartUnit is like RestartUnit, except that a service that isn't running
108108
// is not affected by the restart.
109109
func (c *Conn) TryRestartUnit(name string, mode string) (string, error) {
110-
return c.runJob("TryRestartUnit", name, mode)
110+
return c.runJob("org.freedesktop.systemd1.Manager.TryRestartUnit", name, mode)
111111
}
112112

113113
// ReloadOrRestart attempts a reload if the unit supports it and use a restart
114114
// otherwise.
115115
func (c *Conn) ReloadOrRestartUnit(name string, mode string) (string, error) {
116-
return c.runJob("ReloadOrRestartUnit", name, mode)
116+
return c.runJob("org.freedesktop.systemd1.Manager.ReloadOrRestartUnit", name, mode)
117117
}
118118

119119
// ReloadOrTryRestart attempts a reload if the unit supports it and use a "Try"
120120
// flavored restart otherwise.
121121
func (c *Conn) ReloadOrTryRestartUnit(name string, mode string) (string, error) {
122-
return c.runJob("ReloadOrTryRestartUnit", name, mode)
122+
return c.runJob("org.freedesktop.systemd1.Manager.ReloadOrTryRestartUnit", name, mode)
123123
}
124124

125125
// StartTransientUnit() may be used to create and start a transient unit, which
@@ -131,13 +131,13 @@ func (c *Conn) StartTransientUnit(name string, mode string, properties ...Proper
131131
// the dbus interface for this method does not use the last argument and
132132
// should simply be given an empty list. We use a concrete type here
133133
// (instead of the more appropriate interface{}) to satisfy the dbus library.
134-
return c.runJob("StartTransientUnit", name, mode, properties, make([]string, 0))
134+
return c.runJob("org.freedesktop.systemd1.Manager.StartTransientUnit", name, mode, properties, make([]string, 0))
135135
}
136136

137137
// KillUnit takes the unit name and a UNIX signal number to send. All of the unit's
138138
// processes are killed.
139139
func (c *Conn) KillUnit(name string, signal int32) {
140-
c.sysobj.Call("KillUnit", 0, name, "all", signal).Store()
140+
c.sysobj.Call("org.freedesktop.systemd1.Manager.KillUnit", 0, name, "all", signal).Store()
141141
}
142142

143143
// GetUnitProperties takes the unit name and returns all of its dbus object properties.
@@ -169,7 +169,7 @@ func (c *Conn) GetUnitProperties(unit string) (map[string]interface{}, error) {
169169
// be more unit names loaded than actual units behind them.
170170
func (c *Conn) ListUnits() ([]UnitStatus, error) {
171171
result := make([][]interface{}, 0)
172-
err := c.sysobj.Call("ListUnits", 0).Store(&result)
172+
err := c.sysobj.Call("org.freedesktop.systemd1.Manager.ListUnits", 0).Store(&result)
173173
if err != nil {
174174
return nil, err
175175
}
@@ -226,7 +226,7 @@ func (c *Conn) EnableUnitFiles(files []string, runtime bool, force bool) (bool,
226226
var carries_install_info bool
227227

228228
result := make([][]interface{}, 0)
229-
err := c.sysobj.Call("EnableUnitFiles", 0, files, runtime, force).Store(&carries_install_info, &result)
229+
err := c.sysobj.Call("org.freedesktop.systemd1.Manager.EnableUnitFiles", 0, files, runtime, force).Store(&carries_install_info, &result)
230230
if err != nil {
231231
return false, nil, err
232232
}
@@ -259,5 +259,5 @@ type EnableUnitFileChange struct {
259259
// Reload instructs systemd to scan for and reload unit files. This is
260260
// equivalent to a 'systemctl daemon-reload'.
261261
func (c *Conn) Reload() (string, error) {
262-
return c.runJob("Reload")
262+
return c.runJob("org.freedesktop.systemd1.Manager.Reload")
263263
}

dbus/subscription.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (c *Conn) initDispatch() {
7676

7777
unitName := signal.Body[2].(string)
7878
var unitPath dbus.ObjectPath
79-
c.sysobj.Call("GetUnit", 0, unitName).Store(&unitPath)
79+
c.sysobj.Call("org.freedesktop.systemd1.Manager.GetUnit", 0, unitName).Store(&unitPath)
8080
if unitPath != dbus.ObjectPath("") {
8181
c.sendSubStateUpdate(unitPath)
8282
}

0 commit comments

Comments
 (0)