[Trusty] checkbox-certification-client cannot start

Bug #1285085 reported by Sylvain Pineau
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Next Generation Checkbox (CLI)
Fix Released
High
Sylvain Pineau

Bug Description

checkbox-certification-client cannot start on trusty:

u@u-Vostro-V131:~$ checkbox-certification-client
Traceback (most recent call last):
  File "/usr/share/checkbox/run", line 33, in <module>
    main()
  File "/usr/share/checkbox/run", line 28, in main
    application = manager.create_application(sys.argv)
  File "/usr/lib/python3/dist-packages/checkbox/application.py", line 111, in create_application
    set_logging(options.log_level, options.log)
  File "/usr/lib/python3/dist-packages/checkbox/lib/log.py", line 75, in set_logging
    logging.getLogger().setLevel(log_level)
  File "/usr/lib/python3.4/logging/__init__.py", line 1227, in setLevel
    self.level = _checkLevel(level)
  File "/usr/lib/python3.4/logging/__init__.py", line 178, in _checkLevel
    raise ValueError("Unknown level: %r" % level)
ValueError: Unknown level: 'Level INFO'

Tags: trusty

Related branches

affects: checkbox-certification → checkbox
information type: Proprietary → Public
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

This bug is in checkbox itself. It turns out we were taking advantage of a bug in Python's logging module where getLevelName() would return the log level as an integer if passed a string. This was not documented: http://docs.python.org/3.3/library/logging.html#logging.getLevelName

To fix this I think we have to create a mapping from string to log level and do the conversion ourselves. I don't see any function in logging that will convert a string into a log level for us.

e.g:

LEVELS = {'debug': logging.DEBUG,
          'info': logging.INFO,
          'warning': logging.WARNING,
          'error': logging.ERROR,
          'critical': logging.CRITICAL}

logging.getLogger().setLevel(LEVELS.get(level))

no longer affects: checkbox-certification
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Since python3.2, the The lvl parameter accepts a string representation of the level such as ‘INFO’ as an alternative to the integer constants such as INFO.

A fix would be to just pass level.upper() to the logging setLevel() function.

See http://docs.python.org/3.3/library/logging.html#logging.Logger.setLevel

Changed in checkbox:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Sylvain Pineau (sylvain-pineau)
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

That seems cleaner

Changed in checkbox:
milestone: none → 2014-mar-14
Daniel Manrique (roadmr)
Changed in checkbox:
status: In Progress → Fix Committed
Zygmunt Krynicki (zyga)
affects: checkbox → checkbox-ng
Changed in checkbox-ng:
milestone: 2014-mar-14 → none
Daniel Manrique (roadmr)
Changed in checkbox-ng:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.