Verified Commit 382c9b1e authored by Dmitry Volodin's avatar Dmitry Volodin
Browse files

Fix script's memory leaking

parent 6ad2efaa
Pipeline #8114 failed with stages
in 28 seconds
......@@ -257,7 +257,7 @@ class BaseScript(six.with_metaclass(BaseScriptMetaclass, object)):
finally:
if not self.parent:
# Close SNMP socket when necessary
self.snmp.close()
self.close_snmp()
# Close CLI socket when necessary
self.close_cli_stream()
# Close MML socket when necessary
......@@ -855,6 +855,12 @@ class BaseScript(six.with_metaclass(BaseScriptMetaclass, object)):
self.cli_stream.close()
self.cli_stream = None
def close_snmp(self):
if self.parent:
return
self.snmp.close()
self.snmp = None
def mml(self, cmd, **kwargs):
"""
Execute MML command and return result. Initiate MML session when necessary
......
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