diff options
author | Jeff Lane <jeffrey.lane@canonical.com> | 2017-04-05 17:53:43 -0400 |
---|---|---|
committer | Jeff Lane <jeffrey.lane@canonical.com> | 2017-04-05 17:53:43 -0400 |
commit | fcb2a3af9b294cee30103b4571f6c7ae2b09b17d (patch) | |
tree | dc443c40e6463923ed44801bbeba35ee5ac99f35 /bin | |
parent | 2f138ff99865cf372c5fa9f2f9a4593af42028f9 (diff) |
PEP8 Cleanup
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/dmitest | 78 |
1 files changed, 51 insertions, 27 deletions
diff --git a/bin/dmitest b/bin/dmitest index 58d2f601..4b8c52d9 100755 --- a/bin/dmitest +++ b/bin/dmitest @@ -113,53 +113,68 @@ def standard_tests(args, stream, dmi_data): error. """ if args.test_type == 'server': - if not find_in_section(stream, dmi_data, 'Chassis Information', 'Type:', + if not find_in_section(stream, dmi_data, 'Chassis Information', + 'Type:', ['server', 'rack mount', 'blade', 'other', 'expansion chassis', 'multi-system', 'tower'], False): - dmi_data['Chassis Information']['Type'] += " *** Incorrect or unknown server chassis type!" + dmi_data['Chassis Information']['Type'] += \ + " *** Incorrect or unknown server chassis type!" retval += 1 if find_in_section(stream, dmi_data, 'Base Board Information', 'Type:', ['portable', 'notebook', 'space-saving', 'all in one'], False): - dmi_data['Base Board Information']['Type'] += " *** Incorrect server base board type!" + dmi_data['Base Board Information']['Type'] += \ + " *** Incorrect server base board type!" retval += 1 else: - if not find_in_section(stream, dmi_data, 'Chassis Information', 'Type:', + if not find_in_section(stream, dmi_data, 'Chassis Information', + 'Type:', ['notebook', 'portable', 'laptop', 'desktop', 'lunch box', 'space-saving', 'tower', 'all in one', 'hand held'], False): - dmi_data['Chassis Information']['Type'] += " *** Incorrect or unknown desktop chassis type!" + dmi_data['Chassis Information']['Type'] += \ + " *** Incorrect or unknown desktop chassis type!" retval += 1 if find_in_section(stream, dmi_data, 'Base Board Information', 'Type:', ['rack mount', 'server', 'multi-system', 'interconnect board'], False): - dmi_data['Base Board Information']['Type'] += " *** Incorrect desktop base board type!" + dmi_data['Base Board Information']['Type'] += \ + " *** Incorrect desktop base board type!" retval += 1 - if find_in_section(stream, dmi_data, 'Chassis Information', 'Manufacturer:', + if find_in_section(stream, dmi_data, 'Chassis Information', + 'Manufacturer:', ['empty', 'chassis manufacture', 'null', 'insyde', 'to be filled by o\.e\.m\.', 'no enclosure', '\.\.\.\.\.'], True): - dmi_data['Chassis Information']['Manufacturer'] += " *** Invalid chassis manufacturer!" + dmi_data['Chassis Information']['Manufacturer'] += \ + " *** Invalid chassis manufacturer!" retval += 1 if find_in_section(stream, dmi_data, 'System Information', 'Manufacturer:', ['system manufacture', 'insyde', 'standard', 'to be filled by o\.e\.m\.', 'no enclosure'], True): - dmi_data['System Information']['Manufacturer'] += " *** Invalid system manufacturer!" + dmi_data['System Information']['Manufacturer'] += \ + " *** Invalid system manufacturer!" retval += 1 - if find_in_section(stream, dmi_data, 'Base Board Information', 'Manufacturer:', + if find_in_section(stream, dmi_data, 'Base Board Information', + 'Manufacturer:', ['to be filled by o\.e\.m\.'], True): - dmi_data['Base Board Information']['Manufacturer'] += " *** Invalid base board manufacturer!" + dmi_data['Base Board Information']['Manufacturer'] += \ + " *** Invalid base board manufacturer!" retval += 1 - if find_in_section(stream, dmi_data, 'System Information', 'Product Name:', + if find_in_section(stream, dmi_data, 'System Information', + 'Product Name:', ['system product name', 'to be filled by o\.e\.m\.'], False): - dmi_data['System Information']['Product Name'] += " *** Invalid system product name!" + dmi_data['System Information']['Product Name'] += \ + " *** Invalid system product name!" retval += 1 - if find_in_section(stream, dmi_data, 'Base Board Information', 'Product Name:', + if find_in_section(stream, dmi_data, 'Base Board Information', + 'Product Name:', ['base board product name', 'to be filled by o\.e\.m\.'], False): - dmi_data['Base Board Information']['Product Name'] += " *** Invalid base board product name!" + dmi_data['Base Board Information']['Product Name'] += \ + " *** Invalid base board product name!" retval += 1 return retval @@ -179,18 +194,21 @@ def version_tests(args, stream, dmi_data): if find_in_section(stream, dmi_data, 'Chassis Information', 'Version:', ['to be filled by o\.e\.m\.', 'empty'], False): - dmi_data['Chassis Information']['Version'] += " *** Invalid chassis version!" + dmi_data['Chassis Information']['Version'] += \ + " *** Invalid chassis version!" retval += 1 if find_in_section(stream, dmi_data, 'System Information', 'Version:', ['to be filled by o\.e\.m\.', '\(none\)', 'null', 'system version', 'not applicable', '\.\.\.\.\.'], False): - dmi_data['System Information']['Version'] += " *** Invalid system information version!" + dmi_data['System Information']['Version'] += \ + " *** Invalid system information version!" retval += 1 if find_in_section(stream, dmi_data, 'Base Board Information', 'Version:', ['base board version', 'empty', 'to be filled by o\.e\.m\.'], False): - dmi_data['Base Board Information']['Version'] += " *** Invalid base board version!" + dmi_data['Base Board Information']['Version'] += \ + " *** Invalid base board version!" retval += 1 return retval @@ -207,17 +225,22 @@ def serial_tests(args, stream, dmi_data): Number of problems found """ retval = 0 - if find_in_section(stream, dmi_data, 'System Information', 'Serial Number:', + if find_in_section(stream, dmi_data, 'System Information', + 'Serial Number:', ['to be filled by o\.e\.m\.', 'system serial number', '\.\.\.\.\.'], False): - dmi_data['System Information']['Serial Number'] += " *** Invalid system information serial number!" + dmi_data['System Information']['Serial Number'] += \ + " *** Invalid system information serial number!" retval += 1 - if find_in_section(stream, dmi_data, 'Base Board Information', 'Serial Number:', + if find_in_section(stream, dmi_data, 'Base Board Information', + 'Serial Number:', ['n/a', 'base board serial number', - 'to be filled by o\.e\.m\.', 'empty', '\.\.\.'], + 'to be filled by o\.e\.m\.', + 'empty', '\.\.\.'], False): - dmi_data['Base Board Information']['Serial Number'] += " *** Invalid base board serial number!" + dmi_data['Base Board Information']['Serial Number'] += \ + " *** Invalid base board serial number!" retval += 1 return retval @@ -240,9 +263,9 @@ def main(): bad_data = False dmi_data = {'System Information': {}, - 'Base Board Information': {}, - 'Chassis Information': {}, - 'Processor Information': {}} + 'Base Board Information': {}, + 'Chassis Information': {}, + 'Processor Information': {}} # Command to retrieve DMI information COMMAND = "dmidecode" @@ -283,7 +306,8 @@ def main(): retval += serial_tests(args, stream, dmi_data) if find_in_section(stream, dmi_data, 'Processor Information', 'Version:', ['sample', 'Genuine Intel\(R\) CPU 0000'], False): - dmi_data['Processor Information']['Version'] += " *** Invalid processor information!" + dmi_data['Processor Information']['Version'] += \ + " *** Invalid processor information!" retval += 1 # In review of dmidecode data on 10/23/2014, no conspicuous problems |