AttributeError: 'Colorizer' object has no attribute 'header_'

Bug #1354111 reported by Daniel Manrique
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PlainBox (Toolkit)
Fix Released
High
Daniel Manrique

Bug Description

WHen running a job with a requirement on a non-existent resource, I get a crash and trace ending in:

  File "/src/checkbox/bzr/trunk/plainbox/plainbox/impl/commands/run.py", line 894, in _update_desired_job_list
    print(self.C.header_("Warning", 'YELLOW'))
AttributeError: 'Colorizer' object has no attribute 'header_'

How to reproduce:

- mk-venv your checkbox tree and develop it.
- Create a something.txt file in the checkbox provider's jobs directory
- Add this job (note the bogus resource in the requirement):

id: roadmr
plugin: shell
command: none
requires: 'ka' in bogusinfo.platform
_description: test

Run the job:

run -i 2013.com.canonical.certification::roadmr

Expected result:
- A warning about non-existent resource, but no crash

Actual result:
- Crash ending as seen above.

This patch fixes it (but it may not be the correct solution):

=== modified file 'plainbox/plainbox/impl/commands/run.py'
--- plainbox/plainbox/impl/commands/run.py 2014-08-04 16:51:44 +0000
+++ plainbox/plainbox/impl/commands/run.py 2014-08-07 17:35:37 +0000
@@ -891,7 +891,7 @@
     def _update_desired_job_list(self, desired_job_list):
         problem_list = self.state.update_desired_job_list(desired_job_list)
         if problem_list:
- print(self.C.header_("Warning", 'YELLOW'))
+ print(self.C.header(_("Warning"), 'YELLOW'))
             print(_("There were some problems with the selected jobs"))
             for problem in problem_list:
                 print(" * {}".format(problem))

With that, running the job results in this:

===============================[ Analyzing Jobs ]===============================
==================================[ Warning ]===================================
There were some problems with the selected jobs
 * missing dependency: '2013.com.canonical.certification::bogusinfo' (resource)
Problematic jobs will not be considered
=============================[ Session Statistics ]=============================
This session is about 0.00% complete
Estimated duration cannot be determined for automated jobs.
Estimated duration cannot be determined for manual jobs.
Size of the desired job list: 0
Size of the effective execution plan: 0
===========================[ Running Selected Jobs ]============================
==================================[ Results ]===================================

The problem was introduced as a small mistake in commit 3038 (2014-05-29), in a sub-commit that reads "use C.header() for all headers".

Tags: bite-size
Daniel Manrique (roadmr)
Changed in plainbox:
milestone: 0.10 → 0.12
milestone: 0.12 → 0.11
Daniel Manrique (roadmr)
Changed in plainbox:
assignee: nobody → Daniel Manrique (roadmr)
status: Triaged → Fix Committed
Daniel Manrique (roadmr)
Changed in plainbox:
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.