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]
|
_crawler, ok := s.Crawlers[crawlerName]
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("There is no crawler[%s]", crawlerName)
|
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")
|
return fmt.Errorf("Sensor config is not valid")
|
||||||
}
|
}
|
||||||
|
|
||||||
sensorConfigID := sensorConfig.ConfigID
|
configID := sensorConfig.ConfigID
|
||||||
if _, ok := s.sensorConfigs[sensorConfigID]; ok {
|
if _, ok := s.sensorConfigs[configID]; ok {
|
||||||
return fmt.Errorf("Sensor config[%s] is exist already", sensorConfigID)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -79,14 +79,14 @@ func (s *SensorConfigService) UpdateConfig(sensorConfig *ocsm.SensorConfig) erro
|
||||||
return fmt.Errorf("Sensor config is not valid")
|
return fmt.Errorf("Sensor config is not valid")
|
||||||
}
|
}
|
||||||
|
|
||||||
sensorConfigID := sensorConfig.ConfigID
|
configID := sensorConfig.ConfigID
|
||||||
if _, ok := s.sensorConfigs[sensorConfigID]; !ok {
|
if _, ok := s.sensorConfigs[configID]; !ok {
|
||||||
return fmt.Errorf("Sensor config[%s] is not exist", sensorConfigID)
|
return fmt.Errorf("Sensor config[%s] is not exist", configID)
|
||||||
}
|
}
|
||||||
delete(s.sensorConfigs, sensorConfigID)
|
delete(s.sensorConfigs, configID)
|
||||||
s.sensorConfigs[sensorConfigID] = sensorConfig
|
s.sensorConfigs[configID] = sensorConfig
|
||||||
|
|
||||||
logging.Logger().Debugf("Sensor config[%d] was updated", sensorConfigID)
|
logging.Logger().Debugf("Sensor config[%s] was updated", configID)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user