Bug 1256730 - Fail configure when API keyfiles do not exist or are empty. r?chmanchester draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 09 Aug 2016 18:17:35 +0900
changeset 398543 4b690dedca4feaa36e6e5969340d59cff0366d98
parent 398542 0f6d7bedc94a85c3bdf69999b804d8eefb937973
child 527694 2a1401133d3a029bf7f22558525c6f1d7d02c527
push id25566
push userbmo:mh+mozilla@glandium.org
push dateTue, 09 Aug 2016 10:48:48 +0000
reviewerschmanchester
bugs1256730
milestone51.0a1
Bug 1256730 - Fail configure when API keyfiles do not exist or are empty. r?chmanchester
build/moz.configure/keyfiles.configure
--- a/build/moz.configure/keyfiles.configure
+++ b/build/moz.configure/keyfiles.configure
@@ -10,25 +10,27 @@ def keyfile(desc, help=None):
     help = help or ('Use the secret key contained in the given keyfile '
                     'for %s requests' % desc)
     name = desc.lower().replace(' ', '-')
     option('--with-%s-keyfile' % name, nargs=1, help=help)
 
     @depends('--with-%s-keyfile' % name)
     @checking('for the %s key file' % name, lambda x: bool(x))
     @imports(_from='__builtin__', _import='open')
+    @imports(_from='__builtin__', _import='Exception')
     def keyfile(value):
         if value:
             try:
                 with open(value[0]) as fh:
                     result = fh.read().strip()
                     if result:
                         return result
-            except:
-                pass
+                    raise FatalCheckError('%s is empty' % value[0])
+            except Exception as e:
+                raise FatalCheckError(str(e))
         return 'no-%s-key' % name
 
     return keyfile
 
 
 @template
 def simple_keyfile(desc):
     set_config('MOZ_%s_KEY' % desc.upper().replace(' ', '_'),