diff --git a/.bin/Scripts/functions/osticket.py b/.bin/Scripts/functions/osticket.py index 6cafbd5f..ae72de7d 100644 --- a/.bin/Scripts/functions/osticket.py +++ b/.bin/Scripts/functions/osticket.py @@ -189,11 +189,14 @@ class osTicket(): def generate_report(self, dev, ticket_id, ticket_name): """Generate device report for osTicket, returns list.""" - report = [] + report = [''] results = self.get_device_overall_results(dev) + test_station = TEST_STATIONS.get(get_hostname().lower(), '') # Header - report.append('[Report for ticket #{} {}]'.format(ticket_id, ticket_name)) + if test_station: + report[0] += '[Test-Station: {}] '.format(test_station) + report[0] += '[Report for ticket #{} {}]'.format(ticket_id, ticket_name) if results['Full Diag']: report.append( '{Dev Type} hardware diagnostic tests: {Status}'.format(**results)) @@ -584,6 +587,13 @@ class osTicket(): # Functions +def get_hostname(): + """Get hostname, returns str.""" + cmd = ['hostnamectl', '--static'] + result = run_program(cmd, check=False, encoding='utf-8', errors='ignore') + return result.stdout.strip() + + def pad_with_dots(s, pad_right=False): """Replace space padding with dots, returns str.""" s = str(s).replace(' ', '..') diff --git a/.bin/Scripts/settings/osticket.py b/.bin/Scripts/settings/osticket.py index 6360a579..dc30ced3 100644 --- a/.bin/Scripts/settings/osticket.py +++ b/.bin/Scripts/settings/osticket.py @@ -26,6 +26,22 @@ OSTICKET = { 'Ticket': 'ost_ticket', }, } +TEST_STATIONS = { + 'bender': 'Bender', + 'combine': 'Combine', + 'control': 'Control', + 'cortana': 'Cortana', + 'data': 'Data', + 'glados': 'GLaDOS', + 'locutus': 'Locutus', + 'lore': 'Lore', + 'sex-robot': 'Sex-Robot', + 'shodan': 'Shodan', + 'six': 'Six', + 'skynet': 'Skynet', + 'supremo': 'Supremo', + 'unicron': 'Unicron', + } if __name__ == '__main__': print("This file is not meant to be called directly.")