mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-09 19:29:26 +00:00
godep restore pushd $GOPATH/src/github.com/appc/spec git co master popd go get go4.org/errorutil rm -rf Godeps godep save ./... git add vendor git add -f $(git ls-files --other vendor/) git co -- Godeps/LICENSES Godeps/.license_file_state Godeps/OWNERS
28 lines
581 B
Go
28 lines
581 B
Go
package introspect
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"github.com/godbus/dbus"
|
|
"strings"
|
|
)
|
|
|
|
// Call calls org.freedesktop.Introspectable.Introspect on a remote object
|
|
// and returns the introspection data.
|
|
func Call(o dbus.BusObject) (*Node, error) {
|
|
var xmldata string
|
|
var node Node
|
|
|
|
err := o.Call("org.freedesktop.DBus.Introspectable.Introspect", 0).Store(&xmldata)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
err = xml.NewDecoder(strings.NewReader(xmldata)).Decode(&node)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if node.Name == "" {
|
|
node.Name = string(o.Path())
|
|
}
|
|
return &node, nil
|
|
}
|