diff --git a/.bin/Scripts/functions/hw_diags.py b/.bin/Scripts/functions/hw_diags.py index 18446489..1a5bed02 100644 --- a/.bin/Scripts/functions/hw_diags.py +++ b/.bin/Scripts/functions/hw_diags.py @@ -435,9 +435,17 @@ class DiskObj(): # Check for attributes if KEY_NVME in self.smartctl: - self.nvme_attributes = { - k: {'name': k, 'raw': int(v), 'raw_str': str(v)} - for k, v in self.smartctl[KEY_NVME].items()} + self.nvme_attributes = {} + for k, v in self.smartctl[KEY_NVME].items(): + try: + self.nvme_attributes[k] = { + 'name': k, + 'raw': int(v), + 'raw_str': str(v), + } + except Exception: + # TODO: Limit this check + pass elif KEY_SMART in self.smartctl: for a in self.smartctl[KEY_SMART].get('table', {}): try: @@ -1101,7 +1109,7 @@ def run_hw_tests(state): show_results(state) # Post disk results - if not state.ost.disabled: + if _disk_tests_enabled and state.disks and not state.ost.disabled: print_standard('Posting results to osTicket...') for disk in state.disks: state.ost.post_device_results(disk, state.ticket_id) diff --git a/.bin/Scripts/functions/osticket.py b/.bin/Scripts/functions/osticket.py index bc207b04..0c051974 100644 --- a/.bin/Scripts/functions/osticket.py +++ b/.bin/Scripts/functions/osticket.py @@ -344,6 +344,38 @@ class osTicket(): return type_str + def get_flag(self, ticket_id, flag_name): + """Get flag in osTicket.""" + flag_value = None + self.connect(silent=True) + + # Bail if disabled + if self.disabled: + return + + # Build SQL cmd + sql_cmd = "SELECT `{column}` FROM `{Name}`.`{Ticket}`".format( + column=flag_name, + **OSTICKET['Database'], + **OSTICKET['Tables']) + sql_cmd += "WHERE `{Ticket}`.`ticket_id` = {ticket_id}".format( + ticket_id=ticket_id, + **OSTICKET['Tables']) + sql_cmd += ";" + + # Run SQL cmd and get value + try: + self.db_cursor.execute(sql_cmd) + for s in self.db_cursor: + flag_value = s[0] + except mariadb.errors.Error: + # Set self.errors to enable warning line on results screen + self.errors = True + + # Done + self.disconnect() + return flag_value + def get_ticket_name(self, ticket_id): """Lookup ticket and return name as str.""" name = None @@ -451,6 +483,14 @@ class osTicket(): def set_disk_passed(self, ticket_id): """Mark disk as passed in osTicket.""" + current_value = self.get_flag(ticket_id, OSTICKET['Disk Flag']['Name']) + + # Bail early? + if current_value == OSTICKET['Disk Flag']['Fail']: + print_warning('Not replacing osTicket disk checkbox FAILED value') + return + + # Current value != FAILED, set to passed self.set_flag( ticket_id, OSTICKET['Disk Flag']['Name'], @@ -458,7 +498,7 @@ class osTicket(): def set_flag(self, ticket_id, flag_name, flag_value): """Set flag in osTicket.""" - self.connect() + self.connect(silent=True) # Bail if disabled if self.disabled: diff --git a/.bin/Scripts/install_sw_bundle.py b/.bin/Scripts/install_sw_bundle.py index 9b51c432..a12a3a00 100644 --- a/.bin/Scripts/install_sw_bundle.py +++ b/.bin/Scripts/install_sw_bundle.py @@ -35,6 +35,8 @@ if __name__ == '__main__': if answer_ninite and global_vars['OS']['Version'] in ['7']: # Vista is dead, not going to check for it answer_mse = ask('Install MSE?') + else: + answer_mse = False print_info('Installing Programs') if answer_vcr: diff --git a/.linux_items/include/airootfs/etc/skel/.vimrc b/.linux_items/include/airootfs/etc/skel/.vimrc index d65c6a91..aefcef8a 100644 --- a/.linux_items/include/airootfs/etc/skel/.vimrc +++ b/.linux_items/include/airootfs/etc/skel/.vimrc @@ -54,11 +54,15 @@ endif " 2Shirt Stuff set autoindent " align the new line indent with the previous line set expandtab " insert spaces when hitting TABs +set nowrap " I'd rather manually wrap than manually unwrap set shiftround " round indent to multiple of 'shiftwidth' -set shiftwidth=4 " operation >> indents 4 columns; << unindents 4 columns -set softtabstop=4 " insert/delete 4 spaces when hitting a TAB/BACKSPACE -set tabstop=4 " an hard TAB displays as 4 columns +set shiftwidth=2 " operation >> indents 2 columns; << unindents 2 columns +set softtabstop=2 " insert/delete 2 spaces when hitting a TAB/BACKSPACE +set tabstop=2 " an hard TAB displays as 2 columns " Python Stuff. au FileType python set textwidth=79 " lines longer than 79 columns will be broken +" Do wrap stuff +au FileType text set wrap +