Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions pkg/updateengine/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ type Client struct {
ch chan *dbus.Signal
}

func New() (c *Client, err error) {
c = new(Client)
func New() (*Client, error) {
c := new(Client)
var err error

c.conn, err = dbus.SystemBusPrivate()
if err != nil {
Expand All @@ -64,7 +65,7 @@ func New() (c *Client, err error) {

call := c.conn.BusObject().Call("org.freedesktop.DBus.AddMatch", 0, match)
if call.Err != nil {
return nil, err
return nil, call.Err
}

c.ch = make(chan *dbus.Signal, signalBuffer)
Expand Down Expand Up @@ -115,16 +116,12 @@ func (c *Client) RebootNeededSignal(rcvr chan Status, stop <-chan struct{}) {
}

// GetStatus gets the current status from update_engine
func (c *Client) GetStatus() (result Status, err error) {
func (c *Client) GetStatus() (Status, error) {
call := c.object.Call(dbusInterface+".GetStatus", 0)
err = call.Err
if err != nil {
return
if call.Err != nil {
return Status{}, call.Err
}

result = NewStatus(call.Body)

return
return NewStatus(call.Body), nil
}

// AttemptUpdate will trigger an update if available. This is an asynchronous
Expand Down