Commit d8419830 authored by Aleksey Shirokih's avatar Aleksey Shirokih
Browse files

sanitize chars before processing template

--HG--
branch : feature/microservices
parent f567fb9a
......@@ -28,11 +28,11 @@ class IPSLADashboard(BaseDashboard):
def render(self):
context = {
"device": self.object.name,
"device": self.object.name.replace('\"', ''),
"ip": self.object.address,
"device_id": self.object.id,
"segment": self.object.segment.id,
"probes": [{"name": probe.name, "value": probe.tests[0].target} for
"probes": [{"name": probe.name.replace('\"', ''), "value": probe.tests[0].target} for
probe in SLAProbe.objects.filter(managed_object=self.object.id)]
}
self.logger.info("Context with data: %s" % context)
......
......@@ -29,14 +29,14 @@ class LinkDashboard(BaseDashboard):
def render(self):
mos = self.object
context = {
"device_a": mos.interfaces[0].managed_object.name,
"device_b": mos.interfaces[1].managed_object.name,
"device_a": mos.interfaces[0].managed_object.name.replace('\"', ''),
"device_b": mos.interfaces[1].managed_object.name.replace('\"', ''),
"interface_a": {
"name": mos.interfaces[0].name,
"descr": mos.interfaces[0].description or mos.interfaces[0].name},
"descr": mos.interfaces[0].description.replace('\"', '') or mos.interfaces[0].name},
"interface_b": {
"name": mos.interfaces[1].name,
"descr": mos.interfaces[1].description or mos.interfaces[1].name},
"descr": mos.interfaces[1].description.replace('\"', '') or mos.interfaces[1].name},
"segment": mos.managed_objects[0].segment.id,
"device_a_id": mos.managed_objects[0].id,
"device_b_id": mos.managed_objects[1].id,
......
......@@ -57,10 +57,10 @@ class MODashboard(BaseDashboard):
lags += [{
"name": iface.name,
"ports": [i.name for i in iface.lag_members],
"descr": iface.description or "No description"
"descr": iface.description.replace('\"', '') or "No description"
}]
continue
ports += [{"name": iface.name, "descr": iface.description}]
ports += [{"name": iface.name, "descr": iface.description.replace('\"', '')}]
port_types += [{"type": profile.id, "name": profile.name,
"ports": ports}]
......@@ -82,7 +82,7 @@ class MODashboard(BaseDashboard):
"port_types": self.object_data["port_types"],
"object_metrics": self.object_data["object_metrics"],
"lags": self.object_data["lags"],
"device": self.object.name,
"device": self.object.name.replace('\"', ''),
"ip": self.object.address,
"platform": self.object.platform or "Unknown platform",
"device_id": self.object.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