Merge lp:~roadmr/checkbox/1065703-audio-settings into lp:checkbox

Proposed by Daniel Manrique
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 1834
Merged at revision: 1848
Proposed branch: lp:~roadmr/checkbox/1065703-audio-settings
Merge into: lp:checkbox
Diff against target: 50 lines (+12/-3)
2 files modified
debian/changelog (+2/-0)
scripts/audio_settings (+10/-3)
To merge this branch: bzr merge lp:~roadmr/checkbox/1065703-audio-settings
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Needs Resubmitting
Zygmunt Krynicki (community) Approve
Review via email: mp+135535@code.launchpad.net

Commit message

This code ensures that the audio settings storage file contains the required values. If they're not present, we barf with a useful error message.

Description of the change

This code ensures that the audio settings storage file contains the required values. If they're not present, we barf with a useful error message. Note that I'm not validating the format of the stored data itself. Also, I'm sure this could be done in a more elegant way but I chose this way because it can also easily be adapted to a backport of the fix for 0.14.x.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Thanks, +1

review: Approve
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Attempt to merge into lp:checkbox failed due to conflicts:

text conflict in debian/changelog

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

Fixed changelog and resubmitting :)

review: Needs Resubmitting
1834. By Daniel Manrique

merged from trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2012-12-12 09:48:07 +0000
+++ debian/changelog 2012-12-12 14:39:21 +0000
@@ -2,6 +2,8 @@
22
3 [ Daniel Manrique ]3 [ Daniel Manrique ]
4 * New version 0.15 for Raring Ringtail development.4 * New version 0.15 for Raring Ringtail development.
5 * Fail gracefully with a friendly and useful error message if audio settings
6 file format is invalid. (LP: #1065703)
5 * Added environ key to poweroff and reboot jobs so they create logs in the7 * Added environ key to poweroff and reboot jobs so they create logs in the
6 expected location (LP: #1085833)8 expected location (LP: #1085833)
7 * scripts/memory_compare: Fixed accumulator expression to give good results9 * scripts/memory_compare: Fixed accumulator expression to give good results
810
=== modified file 'scripts/audio_settings'
--- scripts/audio_settings 2012-11-12 13:18:08 +0000
+++ scripts/audio_settings 2012-12-12 14:39:21 +0000
@@ -175,7 +175,16 @@
175 sys.exit(1)175 sys.exit(1)
176176
177 for type in TYPES:177 for type in TYPES:
178 name = settings_file[settings_file.index("default_%s:" % type) + 1]178 #First try to get the three elements we need. If we fail to get any of them, it means
179 #the file's format is incorrect, so we just abort.
180 try:
181 name = settings_file[settings_file.index("default_%s:" % type) + 1]
182 muted = settings_file[settings_file.index("%s_muted:" % type) + 1]
183 volume = settings_file[settings_file.index("%s_volume:" % type) + 1]
184 except ValueError:
185 print("Unable to restore settings because settings file is invalid")
186 sys.exit(1)
187
179 print(name)188 print(name)
180189
181 try:190 try:
@@ -187,7 +196,6 @@
187 if type == "sink":196 if type == "sink":
188 move_sinks(name)197 move_sinks(name)
189198
190 muted = settings_file[settings_file.index("%s_muted:" % type) + 1]
191 print(muted)199 print(muted)
192200
193 try:201 try:
@@ -196,7 +204,6 @@
196 print("Failed to set mute for %s" % device)204 print("Failed to set mute for %s" % device)
197 sys.exit(1)205 sys.exit(1)
198206
199 volume = settings_file[settings_file.index("%s_volume:" % type) + 1]
200 print(volume)207 print(volume)
201208
202 try:209 try:

Subscribers

People subscribed via source and target branches