Verified Commit 621f55f9 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Clean nri_name field on interface when clean on nri_portmap discovery.

parent b11dca86
......@@ -65,6 +65,8 @@ class NRIPortmapperCheck(DiscoveryCheck):
self.logger.debug("[%s] Port mapping %s <-> %s", nri, d["name"], nri_name)
if not nri_name:"[%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:"[%s] Mapping '%s' to '%s'", nri, nri_name, d["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