// updateBugs will find all the bugs the reference the alerting cluster will // write them into the ClusterSummary and save it back to the store. func updateBugs(c *types.ClusterSummary, issueTracker issues.IssueTracker) error { issueSlice, err := issueTracker.FromQuery(fmt.Sprintf(TRACKED_ITEM_URL_TEMPLATE, c.ID)) if err != nil { return fmt.Errorf("Failed to retrieve issue list: %s", err) } bugs := make([]int64, 0, len(issueSlice)) for _, issue := range issueSlice { bugs = append(bugs, issue.ID) } if !util.Int64Equal(bugs, c.Bugs) { c.Bugs = bugs if err := Write(c); err != nil { return fmt.Errorf("Alerting: Failed to write updated cluster with bugs: %s", err) } } return nil }