Commit d29f8f1d authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'fix-nri-portmap' into 'master'

Clean nri_name field on interface when clean on nri_portmap discovery.

See merge request noc/noc!5462
parents e5050e14 621f55f9
...@@ -65,6 +65,8 @@ class NRIPortmapperCheck(DiscoveryCheck): ...@@ -65,6 +65,8 @@ class NRIPortmapperCheck(DiscoveryCheck):
self.logger.debug("[%s] Port mapping %s <-> %s", nri, d["name"], nri_name) self.logger.debug("[%s] Port mapping %s <-> %s", nri, d["name"], nri_name)
if not nri_name: if not nri_name:
self.logger.info("[%s] Cannot map port name '%s'", nri, d["name"]) self.logger.info("[%s] Cannot map port name '%s'", nri, d["name"])
if d.get("nri_name"):
bulk += [UpdateOne({"_id": d["_id"]}, {"$unset": {"nri_name": 1}})]
elif d.get("nri_name") != nri_name: elif d.get("nri_name") != nri_name:
self.logger.info("[%s] Mapping '%s' to '%s'", nri, nri_name, d["name"]) self.logger.info("[%s] Mapping '%s' to '%s'", nri, nri_name, d["name"])
bulk += [UpdateOne({"_id": d["_id"]}, {"$set": {"nri_name": nri_name}})] bulk += [UpdateOne({"_id": d["_id"]}, {"$set": {"nri_name": nri_name}})]
......
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