Comment 1 for bug 1065703

Revision history for this message
Daniel Manrique (roadmr) wrote :

OK, we have 11 instances of this problem, the error trace is as follows (from the above automated error report):

Traceback (most recent call last):
  File "/usr/share/checkbox/scripts/audio_settings", line 182, in <module>
    sys.exit(main())
  File "/usr/share/checkbox/scripts/audio_settings", line 174, in main
    restore_audio_settings(args.file)
  File "/usr/share/checkbox/scripts/audio_settings", line 108, in restore_audio_settings
    index = settings_file[settings_file.index("%s_index:" % type) + 1]
ValueError: 'source_index:' is not in list

Steps to reproduce:

- Run audio_settings restore with a file that does NOT contain correct saved audio settings data:

/usr/share/checkbox/scripts/audio_settings restore --file=/etc/hosts

- Expected result:
 If the file does NOT contain valid key/value pairs, the script should fail gracefully, while outputting a helpful message to stdout.

- Actual result:
  Horrible trace as seen above.

For reference, a valid file looks like this:

source_index: 1
source_muted: no
source_volume: 40632
sink_index: 2
sink_muted: no
sink_volume: 33423

I'm unsure how users are managing to point the script at an invalid file, but the script should still handle this situation more user-friendlily.