diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 524: hack around some configglue warnings

Message ID 20130111035019.27453.8759.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Andy Doan Jan. 11, 2013, 3:50 a.m. UTC
------------------------------------------------------------
revno: 524
committer: Andy Doan <andy.doan@linaro.org>
branch nick: lava-dispatcher
timestamp: Thu 2013-01-10 15:37:58 -0600
message:
  hack around some configglue warnings
modified:
  lava_dispatcher/config.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dispatcher/config.py'
--- lava_dispatcher/config.py	2013-01-04 00:03:43 +0000
+++ lava_dispatcher/config.py	2013-01-10 21:37:58 +0000
@@ -198,6 +198,24 @@ 
     scp.extra_sections = set(scp.get('__main__', 'boot_options'))
 
 
+def _hack_report(report):
+    """
+    ConfigGlue makes warning for somethings we don't want to warn about. In
+    particular, it will warn if a value isn't known to the config such as
+    in the case where you are using config variables or where you define
+    something like a boot_option for master like "boot_cmds_fdt"
+    """
+    scrubbed = []
+    ignores = [
+        'Configuration includes invalid options for section',
+    ]
+    for err in report:
+        for ignore in ignores:
+            if not err.startswith(ignore):
+                scrubbed.append(err)
+    return scrubbed
+
+
 def get_device_config(name, config_dir):
     # We read the device config once to get the device type, then we start
     # again and read device-defaults, device-types/$device-type and
@@ -215,7 +233,11 @@ 
     _hack_boot_options(real_device_config)
     valid, report = real_device_config.is_valid(report=True)
     if not valid:
-        logging.warning("Device config for %s is not valid:\n    %s", name, '\n    '.join(report))
+        report = _hack_report(report)
+        if len(report) > 0:
+            report = '\n    '.join(report)
+            logging.warning(
+                "Device config for %s is not valid:\n    %s", name, report)
 
     return DeviceConfig(real_device_config)