Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

api_service: Improve machined call error output #3059

Merged
merged 1 commit into from Aug 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions rkt/api_service.go
Expand Up @@ -16,7 +16,6 @@ package main

import (
"encoding/json"
"errors"
"fmt"
"net"
"os"
Expand Down Expand Up @@ -479,15 +478,16 @@ func waitForMachinedRegistration(uuid string) error {
machined := conn.Object("org.freedesktop.machine1", "/org/freedesktop/machine1")
machineName := "rkt-" + uuid

var machinedErr error
var o dbus.ObjectPath
for i := 0; i < 10; i++ {
if err := machined.Call("org.freedesktop.machine1.Manager.GetMachine", 0, machineName).Store(&o); err == nil {
if machinedErr = machined.Call("org.freedesktop.machine1.Manager.GetMachine", 0, machineName).Store(&o); machinedErr == nil {
return nil
}
time.Sleep(time.Millisecond * 50)
}

return errors.New("pod not found")
return fmt.Errorf("pod %v not found in machined: %v", uuid, machinedErr)
}

// fillPodDetails fills the v1pod's dynamic info in place, e.g. the pod's state,
Expand Down Expand Up @@ -555,7 +555,7 @@ func fillPodDetails(store *imagestore.Store, p *pod, v1pod *v1alpha.Pod) {
if err := waitForMachinedRegistration(v1pod.Id); err != nil {
// If there's an error, it means we're not registered to machined
// in a reasonable time. Just output the cgroup we're in.
stderr.PrintE("checking for machined registration failed", err)
stderr.PrintE("checking for machined registration failed: ", err)
}
// Get cgroup for the "name=systemd" controller.
pid, err := p.getContainerPID1()
Expand Down