func CreateRootNode(g *graph.Graph) *graph.Node { hostID := config.GetConfig().GetString("host_id") m := graph.Metadata{"Name": hostID, "Type": "host"} if config.GetConfig().IsSet("agent.metadata") { subtree := config.GetConfig().Sub("agent.metadata") for key, value := range subtree.AllSettings() { m[key] = value } } buffer, err := ioutil.ReadFile("/var/lib/cloud/data/instance-id") if err == nil { m["InstanceID"] = strings.TrimSpace(string(buffer)) } u, _ := uuid.NewV5(uuid.NamespaceOID, []byte(hostID)) return g.NewNode(graph.Identifier(u.String()), m) }