parent
73bd9bb009
commit
dfe009c413
1 changed files with 8 additions and 2 deletions
|
|
@ -30,7 +30,7 @@ class osTicket():
|
||||||
self.tests_disk = tests_disk
|
self.tests_disk = tests_disk
|
||||||
self.tunnel_proc = None
|
self.tunnel_proc = None
|
||||||
|
|
||||||
def connect(self):
|
def connect(self, silent=True):
|
||||||
"""Establish connection to osTicket via a SSH tunnel."""
|
"""Establish connection to osTicket via a SSH tunnel."""
|
||||||
cmd = [
|
cmd = [
|
||||||
'ssh', '-N',
|
'ssh', '-N',
|
||||||
|
|
@ -74,6 +74,11 @@ class osTicket():
|
||||||
if self.db_cursor is None:
|
if self.db_cursor is None:
|
||||||
self.disabled = True
|
self.disabled = True
|
||||||
self.tunnel_proc.kill()
|
self.tunnel_proc.kill()
|
||||||
|
if not silent:
|
||||||
|
print_warning('Failed to connect to osTicket')
|
||||||
|
print_standard('Integration disabled for this session')
|
||||||
|
print_standard(' ')
|
||||||
|
pause()
|
||||||
|
|
||||||
def convert_report(self, name, test):
|
def convert_report(self, name, test):
|
||||||
"""Convert report into an osTicket friendly format, returns list."""
|
"""Convert report into an osTicket friendly format, returns list."""
|
||||||
|
|
@ -354,7 +359,7 @@ class osTicket():
|
||||||
def get_ticket_number(self):
|
def get_ticket_number(self):
|
||||||
"""Get ticket number and confirm with name from osTicket DB."""
|
"""Get ticket number and confirm with name from osTicket DB."""
|
||||||
ticket_number = None
|
ticket_number = None
|
||||||
self.connect()
|
self.connect(silent=False)
|
||||||
|
|
||||||
# Bail if disabled
|
# Bail if disabled
|
||||||
if self.disabled:
|
if self.disabled:
|
||||||
|
|
@ -369,6 +374,7 @@ class osTicket():
|
||||||
# No ticket ID entered
|
# No ticket ID entered
|
||||||
if re.match(r'^\s*$', _input):
|
if re.match(r'^\s*$', _input):
|
||||||
if ask('Disable osTicket integration for this run?'):
|
if ask('Disable osTicket integration for this run?'):
|
||||||
|
self.disabled = True
|
||||||
break
|
break
|
||||||
|
|
||||||
# Invalid ID entered
|
# Invalid ID entered
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue