Skip to content

ListUnitsByNames returns an error #223

@rebeccaskinner

Description

@rebeccaskinner

What Happens:

Calling the ListUnitsByNames function on *dbus.Conn results in an unexpected error: Unknown method 'ListUnitsByNames' or interface 'org.freedesktop.systemd1.Manager'

What I expected to happen:

A slice of UnitStatus and no error, or a more descriptive error message.

How to reproduce:

Sample Code:

package main
import (
	"fmt"
	"github.com/coreos/go-systemd/dbus"
)

func main() {
	conn, err := dbus.New()
	if err != nil {
		fmt.Println("error getting connection: ", err)
	}
	res, err := conn.ListUnitsByNames([]string{"acpid.service"})
	if err != nil {
		fmt.Println("error with ListUnitsByNames: ", err)
		return
	}
	fmt.Printf("got %d results\n", len(res))
}

Test system:

uname -a; lsb_release -a
Linux rebecca-vboxdev 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.2 LTS
Release:	16.04
Codename:	xenial

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions