Comment 3 for bug 1183236

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

Awesome! OK, so I downloaded the hexr source and ran the submission parser script. This basically uses the checkbox submission parser module, parses the xml and produces a json file with a representation of all the stuff like devices, packages and so on.

- bzr branch lp:hexr
- Apply the below patch
- Ensure you have a checkbox source tree somewhere
- Run the parser like this:
PYTHONPATH=$PATH_TO_YOUR_CHECKBOX_TRUNK python apps/uploads/checkbox_parser.py submission.xml -v >/tmp/output.json

Looking at both the output.json and the log.log file produced by the parser, what's happening is that the plainbox submission results in two "devices" dictionaries existing. One is taken from the dmi devices (these are the first 5 devices that plainbox submissions have). The other one contains most devices and is taken from the udev element.

On the other hand, the checkbox-produced submission results in just one "devices" dictionary.

This is helpful in reproducing the problem locally and getting closer to the root cause of the problem. Next I'll look at the ordering of attachments in plainbox vs. checkbox submissions and see if we can do a workaround there. The real fix for this would be having the parser *not* create two "devices" elements, but updating the parser in c4 is slightly more complex.

=== modified file 'apps/uploads/checkbox_parser.py'
--- apps/uploads/checkbox_parser.py 2012-11-21 16:58:07 +0000
+++ apps/uploads/checkbox_parser.py 2013-05-23 19:07:54 +0000
@@ -131,11 +131,13 @@
     parser.add_argument("-v", "--verbose",
         action="store_true",
         help="Turn-on verbosity to get more info on what's going on.")
+ parser.add_argument("-l", "--logfile", default="log.log",
+ help="Log file")
     args = parser.parse_args()

     # Set up logger to console
     format = '%(asctime)s %(levelname)-8s %(message)s'
- console_handler = logger.StreamHandler()
+ console_handler = logging.StreamHandler()
     console_handler.setFormatter(logging.Formatter(format))

     # Set up the overall logger
@@ -145,7 +147,7 @@
     root_logger.setLevel(logging.DEBUG)

     if args.verbose:
- verbose_handler = logging.FileHandler(logfile)
+ verbose_handler = logging.FileHandler(args.logfile)
         verbose_handler.setLevel(logging.DEBUG)
         verbose_handler.setFormatter(logging.Formatter(format))
         root_logger.addHandler(verbose_handler)