Add default entity and edge to graph on runtime load

Upstream-commit: 2e6b241dc70c0f1ed6745af1f27b11bf77c84f3b
Component: engine
This commit is contained in:
Michael Crosby
2013-10-24 10:25:07 -07:00
committed by Victor Vieux
parent c646f3b347
commit 33d75fdf08

View File

@ -257,6 +257,13 @@ func (runtime *Runtime) restore() error {
return len(ic.Links) < len(jc.Links)
})
for _, container := range containers {
// Try to set the default name for a container if it exists prior to links
// Ignore the error because if it already exists you will get an invalid constraint
if _, err := runtime.containerGraph.Set(fmt.Sprintf("/%s", container.ID), container.ID); err != nil {
utils.Debugf("Setting default id - %s", err)
}
if err := runtime.Register(container); err != nil {
utils.Debugf("Failed to register container %s: %s", container.ID, err)
continue