예제 #1
0
func (this *SafeHostGroupsMap) Init() {
	var hostGroupMap map[int][]int

	if g.Config().ExternalNodes == "" {
		m, err := db.QueryHostGroups()
		if err != nil {
			return
		}
		hostGroupMap = m
	} else {
		m, err := enc.QueryHostGroups()
		if err != nil {
			return
		}
		hostGroupMap = m
	}

	this.Lock()
	defer this.Unlock()
	this.M = hostGroupMap
	debug := g.Config().Debug
	if debug {
		log.Printf("[DEBUG][CACHE] group.init : %v", this.M)
	}
}
예제 #2
0
func (this *SafeHostGroupsMap) Init() {
	m, err := db.QueryHostGroups()
	if err != nil {
		return
	}

	this.Lock()
	defer this.Unlock()
	this.M = m
}