Reset tunnel_proc to None on full disconnect
This commit is contained in:
parent
b3da1390a1
commit
d9ab1730b4
1 changed files with 15 additions and 1 deletions
|
|
@ -139,7 +139,7 @@ class osTicket():
|
|||
# Done
|
||||
return out_report
|
||||
|
||||
def disconnect(self, reset_errors=False):
|
||||
def disconnect(self, full=False):
|
||||
"""Close osTicket connection."""
|
||||
try:
|
||||
self.db_cursor.close()
|
||||
|
|
@ -148,10 +148,24 @@ class osTicket():
|
|||
# Ignore errors since vars will be reset below
|
||||
pass
|
||||
|
||||
# Reset errors
|
||||
if full:
|
||||
self.errors = False
|
||||
|
||||
# Reset vars
|
||||
self.db_cursor = None
|
||||
self.db_connection = None
|
||||
|
||||
# Close tunnel
|
||||
if full:
|
||||
try:
|
||||
self.tunnel_proc.kill()
|
||||
self.tunnel_proc.wait(timeout=2)
|
||||
except (AttributeError, subprocess.TimeoutExpired):
|
||||
# Ignore and continue
|
||||
pass
|
||||
self.tunnel_proc = None
|
||||
|
||||
def generate_report(self, dev, ticket_id):
|
||||
"""Generate device report for osTicket, returns list."""
|
||||
report = []
|
||||
|
|
|
|||
Loading…
Reference in a new issue