ing
This commit is contained in:
		
							parent
							
								
									a5a918287b
								
							
						
					
					
						commit
						bd3b3f578e
					
				@ -47,7 +47,7 @@ func (s *CrawlerService) DestroyService() {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *CrawlerService) Auth(crawlerName string, auth map[string]string) error {
 | 
			
		||||
func (s *CrawlerService) Auth(crawlerName string, auth map[string]interface{}) error {
 | 
			
		||||
	_crawler, ok := s.Crawlers[crawlerName]
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return fmt.Errorf("There is no crawler[%s]", crawlerName)
 | 
			
		||||
 | 
			
		||||
@ -63,13 +63,13 @@ func (s *SensorConfigService) AddConfig(sensorConfig *ocsm.SensorConfig) error {
 | 
			
		||||
		return fmt.Errorf("Sensor config is not valid")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sensorConfigID := sensorConfig.ConfigID
 | 
			
		||||
	if _, ok := s.sensorConfigs[sensorConfigID]; ok {
 | 
			
		||||
		return fmt.Errorf("Sensor config[%s] is exist already", sensorConfigID)
 | 
			
		||||
	configID := sensorConfig.ConfigID
 | 
			
		||||
	if _, ok := s.sensorConfigs[configID]; ok {
 | 
			
		||||
		return fmt.Errorf("Sensor config[%s] is exist already", configID)
 | 
			
		||||
	}
 | 
			
		||||
	s.sensorConfigs[sensorConfigID] = sensorConfig
 | 
			
		||||
	s.sensorConfigs[configID] = sensorConfig
 | 
			
		||||
 | 
			
		||||
	logging.Logger().Debugf("Sensor config[%d] was added", sensorConfigID)
 | 
			
		||||
	logging.Logger().Debugf("Sensor config[%s] was added", configID)
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
@ -79,14 +79,14 @@ func (s *SensorConfigService) UpdateConfig(sensorConfig *ocsm.SensorConfig) erro
 | 
			
		||||
		return fmt.Errorf("Sensor config is not valid")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sensorConfigID := sensorConfig.ConfigID
 | 
			
		||||
	if _, ok := s.sensorConfigs[sensorConfigID]; !ok {
 | 
			
		||||
		return fmt.Errorf("Sensor config[%s] is not exist", sensorConfigID)
 | 
			
		||||
	configID := sensorConfig.ConfigID
 | 
			
		||||
	if _, ok := s.sensorConfigs[configID]; !ok {
 | 
			
		||||
		return fmt.Errorf("Sensor config[%s] is not exist", configID)
 | 
			
		||||
	}
 | 
			
		||||
	delete(s.sensorConfigs, sensorConfigID)
 | 
			
		||||
	s.sensorConfigs[sensorConfigID] = sensorConfig
 | 
			
		||||
	delete(s.sensorConfigs, configID)
 | 
			
		||||
	s.sensorConfigs[configID] = sensorConfig
 | 
			
		||||
 | 
			
		||||
	logging.Logger().Debugf("Sensor config[%d] was updated", sensorConfigID)
 | 
			
		||||
	logging.Logger().Debugf("Sensor config[%s] was updated", configID)
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user