`plainbox session export` doesn't work anymore

Bug #1659508 reported by Pierre Equoy on 2017-01-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PlainBox (Toolkit)
High
Maciej Kisielewski

Bug Description

With latest plainbox in stable PPA as well as current version in master, although we can get the list of available exporters:

$ plainbox session export -f ? somerville-cli-2016-11-03T06.05.22
Available output formats: 2013.com.canonical.plainbox::hexr, 2013.com.canonical.plainbox::html, 2013.com.canonical.plainbox::json, 2013.com.canonical.plainbox::rfc822, 2013.com.canonical.plainbox::text, 2013.com.canonical.plainbox::tar, 2013.com.canonical.plainbox::xlsx, 2013.com.canonical.plainbox::global, 2013.com.canonical.plainbox::junit, xml, global, junit, xlsx, text, tar, json, html, rfc822

We cannot use them:

$ plainbox session export -f text somerville-cli-2016-11-03T06.05.22
usage: plainbox session export [-h] [--flag FLAG] [-f FORMAT] [-p OPTIONS]
                               [-o FILE]
                               SESSION-ID
plainbox session export: error: argument -f/--output-format: invalid choice: 'text' (choose from '?')

$ plainbox session export -f "2013.com.canonical.plainbox::text" somerville-cli-2016-11-03T06.05.22
usage: plainbox session export [-h] [--flag FLAG] [-f FORMAT] [-p OPTIONS]
                               [-o FILE]
                               SESSION-ID
plainbox session export: error: argument -f/--output-format: invalid choice: '2013.com.canonical.plainbox::text' (choose from '?')

$ plainbox session export -f xml somerville-cli-2016-11-03T06.05.22
usage: plainbox session export [-h] [--flag FLAG] [-f FORMAT] [-p OPTIONS]
                               [-o FILE]
                               SESSION-ID
plainbox session export: error: argument -f/--output-format: invalid choice: 'xml' (choose from '?')

Changed in plainbox:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Maciej Kisielewski (kissiel)
milestone: none → future
milestone: future → 0.33.0
Maciej Kisielewski (kissiel) wrote :

The problem was introduced with my "commands:cmd_session: don't get_exporter_names() when not needed" 84e3b2c96566df7322a2dd661c260b60604b55bc.

For each subcommand that we have in plainbox we have split them to (at least) two files. cmd_* and inv_*. The former having the declaration of arg and its options and the latter having the implementation. This ensures that every module that invocation needs is only loaded when we invoke the command.

With my 84e3b2 patch I removed checking of all available exporters in the cmd_ phase. This led to a plainbox starting up 4x faster. I left '?' as the only possible value of --output-format, and when invoked with that arg, it would actually pull all exporters from providers and list them, as it would run through the inv_ phase.

Maciej Kisielewski (kissiel) wrote :

The fix is not to check the choice on the cmd_ phase.

Changed in plainbox:
status: In Progress → Fix Committed
Changed in plainbox:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers