func()

in plugins/core/reporter/config_discovery.go [46:75]


func (s *ConfigDiscoveryService) HandleCommand(command *common.Command) {
	var uuid string
	var newConfigs = make(map[string]*common.KeyStringValuePair)
	for _, pair := range command.GetArgs() {
		if pair.Key == "SerialNumber" {
		} else if pair.Key == "UUID" {
			uuid = pair.Value
		} else {
			newConfigs[pair.Key] = pair
		}
	}

	// check same uuid
	if s.UUID == uuid {
		return
	}

	// notify to all watchers
	for key, watcher := range s.watchers {
		pair := newConfigs[key]
		if pair == nil || pair.Value == "" {
			watcher.Notify(DELETED, "")
		} else if pair.Value != watcher.Value() {
			watcher.Notify(MODIFY, pair.Value)
		}
	}

	// update uuid
	s.UUID = uuid
}