Rally does not show "missing argument" error raised by argparse while parsing cli args

Bug #1562916 reported by Piyush
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rally
Fix Released
Undecided
Piyush

Bug Description

Consider following command- "rally verify compare"

Correct usage-
[root@piyush-104 custom_rally]# rally verify compare --uuid-1 C1 --uuid-2 C2

EXISTING BEHAVIOR-
[root@piyush-104 custom_rally]# rally verify compare
usage: rally verify compare [-h] --uuid-1 <uuid_1> --uuid-2 <uuid_2> [--csv]
                            [--html] [--json] [--output-file <output_file>]
                            [--threshold <threshold>]
                            [action_args [action_args ...]]

Compare two verification results.

optional arguments:
  -h, --help show this help message and exit
  --uuid-1 <uuid_1> UUID of the first verification
  --uuid-2 <uuid_2> UUID of the second verification
  --csv Display results in CSV format
  --html Display results in HTML format
  --json Display results in JSON format
  --output-file <output_file>
                        Path to a file to save results
  --threshold <threshold>
                        If specified, timing differences must exceed this
                        percentage threshold to be included in output

<<NO ERROR MESSAGE FOR MISSING ARGUMENT>>

EXPECTED BEHAVIOR-
Rally should also display ERROR MESSAGE saying "Missing arguments" like it does in the following case-
[root@piyush-104 custom_rally]# rally task start
Start benchmark task.

        If both task_args and task_args_file are specified, they will
        be merged. task_args has a higher priority so it will override
        values from task_args_file.
......
......
......
Command categories:
  {version,bash-completion,show,task,plugin,verify,deployment}
                        Available categories
Missing arguments: <<< ERROR MESSAGE DISPLAYED INFORMING MISSING ARGUMENT
 --task

REASON-
This happens because during "rally task start" the MissingArgs exception is raised by validate_args() function at https://github.com/openstack/rally/blob/master/rally/cli/cliutils.py#L98

However, in case of "rally verify compare", the error is thrown at https://github.com/openstack/rally/blob/master/rally/cli/cliutils.py#L473 by the argparse library itself. The code does not reach the function call validate_args().

SOLUTION-
Display missing argument based on error message at https://github.com/openstack/rally/blob/master/rally/cli/cliutils.py#L285

Piyush (pirsriva)
Changed in rally:
assignee: nobody → Piyush Raman Srivastava (pirsriva)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to rally (master)

Fix proposed to branch: master
Review: https://review.openstack.org/298349

Changed in rally:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to rally (master)

Reviewed: https://review.openstack.org/298349
Committed: https://git.openstack.org/cgit/openstack/rally/commit/?id=9752bf0d28a2869e5ae4cbd5ef78bb8af0ac71f3
Submitter: Jenkins
Branch: master

commit 9752bf0d28a2869e5ae4cbd5ef78bb8af0ac71f3
Author: Piyush Raman Srivastava <email address hidden>
Date: Mon Mar 28 22:25:11 2016 +0530

    Show Missing Argument Error raised by Argparse

    Fix rally to display Missing Argument error raised by argparse
    during parsing of cli arguments. Refer to bug for more
    description.

    Change-Id: I0d092349dacc66d3baefa327cbf5a5cbf227e9ee
    Closes-Bug: #1562916

Changed in rally:
status: In Progress → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/rally 0.4.0

This issue was fixed in the openstack/rally 0.4.0 release.

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.