pre-upload: fix fallback hook loading with some configs

We set up some defaults at the end of _get_override_hooks, but these
only get added when the config has a [Hook Overrides] section.  Rework
the code so we always add the defaults.

TEST=CQ passes

Change-Id: If589e9f1ca881f262f1feb9f32efbf37e339a224
Reviewed-by: Chris McDonald <>
Commit-Queue: Mike Frysinger <>
Tested-by: Mike Frysinger <>
diff --git a/ b/
index d65946d..46380e7 100755
--- a/
+++ b/
@@ -1884,15 +1884,14 @@
   SECTION = 'Hook Overrides'
   SECTION_OPTIONS = 'Hook Overrides Options'
-  if not config.has_section(SECTION):
-    return set(), set()
   valid_keys = set(_HOOK_FLAGS.keys())
   hooks = _HOOK_FLAGS.copy()
+  options = config.options(SECTION) if config.has_section(SECTION) else []
   enable_flags = []
   disable_flags = []
-  for flag in config.options(SECTION):
+  for flag in options:
     if flag not in valid_keys:
       raise ValueError('Error: unknown key "%s" in hook section of "%s"' %
                        (flag, _CONFIG_FILE))