Commit 21029c9b authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Cleanup MeasurementUnits on sensor loader.

parent 5ccb67be
Pipeline #36358 passed with stages
in 15 minutes and 55 seconds
......@@ -10,6 +10,7 @@ from .base import BaseLoader
from ..models.sensor import Sensor
from noc.inv.models.object import Object
from noc.inv.models.sensor import Sensor as SensorModel
from import MeasurementUnits
class SensorLoader(BaseLoader):
......@@ -24,6 +25,10 @@ class SensorLoader(BaseLoader):
discard_deferred = True
workflow_event_model = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.clean_map["units"] = lambda x: MeasurementUnits.get_by_name(x) if x else None
def find_object(self, v):
Find object by remote system/remote id
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment