Some checkbox_ng commands don't use the PlainboxConfig objects when running jobs

Bug #1298166 reported by Daniel Manrique
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Next Generation Checkbox (CLI)
Fix Released
Critical
Zygmunt Krynicki
PlainBox (Toolkit)
Fix Released
Critical
Zygmunt Krynicki

Bug Description

I was looking at why when using canonical-certification-server, the environment variables aren't read from the /etc/xdg/*.conf files (in the environ section). I created a very simple job that just prints "env", to ensure that the environment is set in the simplest of cases.

Variables I set in the config file didn't show up in env output. Interestingly this happened both with canonical-certification-server and with plainbox run.

So I went looking at the difference between canonical-certification-server and checkbox sru, since I know this mechanism is working fine for SRU (and mini-ci).

I found that sru has a _run_single_job method that uses the applogic.run_job_if_possible method, to which it passes the config object:

        job_state, job_result = run_job_if_possible(
            self.session, self.runner, self.config, job)

Then, run_job_if_possible does pass the config object to the runner's run_job:
    if job_state.can_start():
        job_result = runner.run_job(job, config)

However, CliInvocation (from cli.py) has a _run_single_job_with_session method which encapsulates all the job running logic, and has this:

    if job_state.can_start():
        job_result = runner.run_job(job)

SO it's not passing the config object (which at this point is similarly available in self.config) and thus the settings, particularly the environment, are ignored.

Just to verify, I modified the call to this:
        job_result = runner.run_job(job, self.config)

In this case my dummy job did print the variables correctly (although they're not uppercased as they should be).

This appears to also be the case with "plainbox run", as plainbox/impl/commands/run.py has this:

            job_result = runner.run_job(job)

The code section where this is is nearly identical to the one from checkbox_ng cli.py.

Finally I found another instance of run_job() with no config passed in plainbox's analyze.py file.

Related branches

Daniel Manrique (roadmr)
description: updated
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Take it if you feel like it. It's pretty serious and we should fix it for the 0.3 release ASAP

Changed in checkbox:
status: New → Triaged
importance: Undecided → Critical
milestone: none → checkbox-ng-0.3
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I will fix this today.

Changed in checkbox:
assignee: nobody → Zygmunt Krynicki (zkrynicki)
Zygmunt Krynicki (zyga)
Changed in checkbox:
status: Triaged → In Progress
Zygmunt Krynicki (zyga)
Changed in checkbox:
status: In Progress → Fix Committed
Zygmunt Krynicki (zyga)
Changed in plainbox:
milestone: none → 0.5.3
Changed in checkbox-ng:
milestone: none → 0.3
status: New → Fix Committed
Changed in plainbox:
status: New → Fix Committed
importance: Undecided → Critical
Changed in checkbox-ng:
importance: Undecided → Critical
assignee: nobody → Zygmunt Krynicki (zkrynicki)
Changed in plainbox:
assignee: nobody → Zygmunt Krynicki (zkrynicki)
Changed in checkbox:
milestone: checkbox-ng-0.3 → none
Zygmunt Krynicki (zyga)
Changed in checkbox-ng:
status: Fix Committed → Fix Released
status: Fix Released → Fix Committed
Changed in plainbox:
status: Fix Committed → Fix Released
Zygmunt Krynicki (zyga)
Changed in checkbox-ng:
status: Fix Committed → Fix Released
Zygmunt Krynicki (zyga)
no longer affects: checkbox
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.