The datastore parameter for configuration-create is documented as optional but appears to be required

Bug #1365702 reported by Duk Loi
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-troveclient
Fix Released
Low
Mayuri Ganguly

Bug Description

From the help for the configuration-create command it appears the datastore argument should be optional.

vagrant@controller:~$ trove help configuration-create
usage: trove configuration-create <name> <values>
                                  [--datastore <datastore>]
                                  [--datastore_version <datastore_version>]
                                  [--description <description>]

Creates a configuration group.

Positional arguments:
  <name> Name of the configuration group.
  <values> Dictionary of the values to set.

Optional arguments:
  --datastore <datastore> Datastore assigned to the configuration
                                  group.
  --datastore_version <datastore_version>
                                  Datastore version ID assigned to the
                                  configuration group.
  --description <description> An optional description for the
                                  configuration group.

When you execute the command as follows you get an error indicating the datastore argument is required.

vagrant@controller:~$ trove configuration-create newgroup '{"collation_server":"latin1_swedish_ci"}'
ERROR: Please specify datastore. (HTTP 400)

If you add the datastore argument then the command succeeds.

vagrant@controller:~$ trove configuration-create newgroup '{"collation_server":"latin1_swedish_ci"}' --datastore d0175a3b-1cfe-4ba0-8dc9-1e0401a53ce7
+------------------------+-------------------------------------------+
| Property | Value |
+------------------------+-------------------------------------------+
| created | 2014-09-04T20:27:15 |
| datastore_name | mysql |
| datastore_version_id | 679792eb-6e2d-49d0-b255-c79319d0d9bd |
| datastore_version_name | mysql-5.5 |
| description | None |
| id | 466b7ceb-40f2-4f3e-a8dd-117ec752d01b |
| instance_count | 0 |
| name | newgroup |
| updated | 2014-09-04T20:27:15 |
| values | {"collation_server": "latin1_swedish_ci"} |
+------------------------+-------------------------------------------+

Not sure if the parameter is supposed to be optional or not but the documentation should be changed to match the code or the code changed to match the documentation.

Revision history for this message
Victoria Martinez de la Cruz (vkmc) wrote :

This happens as well with the datastore-version and size optional parameters.

[vkmc@heisenbug ~]$ trove create foo 2
ERROR: Please specify datastore. (HTTP 400)
[vkmc@heisenbug ~]$ trove create fun 2 --datastore mysql
ERROR: Default version for datastore 'mysql' not found. (HTTP 400)
[vkmc@heisenbug ~]$ trove create fun 2 --datastore mysql --datastore_version mysql-5.5
ERROR: Volume size was not specified. (HTTP 400)
[vkmc@heisenbug ~]$ trove create fun 2 --datastore mysql --datastore_version mysql-5.5 --size=2
+-------------------+--------------------------------------+
| Property | Value |
+-------------------+--------------------------------------+
| created | 2014-12-29T20:45:57 |
| datastore | mysql |
| datastore_version | mysql-5.5 |
| flavor | 2 |
| id | 18807037-18da-4539-95b5-df636b08bf67 |
| name | fun |
| status | BUILD |
| updated | 2014-12-29T20:45:57 |
| volume | 2 |
+-------------------+--------------------------------------+

Simply making them required would solve the problem.

Revision history for this message
Victoria Martinez de la Cruz (vkmc) wrote :

Sorry, wrong command, I'll report the bug for trove create.

Revision history for this message
Mayuri Ganguly (mayuri-ganguly) wrote :

If you have more than one datastore version, only then you need to specify the version, else you may not. Since there is only one datastore version for the case below, I need not specify it exclusively.

vagrant@trustystack:~/trove-integration/scripts$ trove configuration-create trove_def2 '{"max_connections": 5}'
+------------------------+--------------------------------------+
| Property | Value |
+------------------------+--------------------------------------+
| created | 2015-02-11T04:59:37 |
| datastore_name | mysql |
| datastore_version_id | a6ef0408-1703-4510-9798-4181b24cb19a |
| datastore_version_name | 5.5 |
| description | None |
| id | 69cabbc2-9895-491d-bbe6-5f1a8dd00c00 |
| instance_count | 0 |
| name | trove_def2 |
| updated | 2015-02-11T04:59:37 |
| values | {u'max_connections': 5} |
+------------------------+--------------------------------------+

Revision history for this message
Amrith Kumar (amrith) wrote :

Mayuri, I think you are illustrating the confusion highlighted by this bug report. The lineal form presented for the command in docopt notation includes the positional and required arguments 'name' and 'value' and the three optional arguments. What the bug is illustrating is that while shown as optional, it is really that it is 'sometimes optional' which doesn't have a good representation in docopt.

Revision history for this message
Amrith Kumar (amrith) wrote :

docopt reference: http://docopt.org/

Revision history for this message
Mayuri Ganguly (mayuri-ganguly) wrote :

You are right, Amrith. Since the argument is not always optional, so my last comment just counts as an illustration of the bug.

Changed in python-troveclient:
assignee: nobody → Mayuri Ganguly (mayuri-ganguly)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-troveclient (master)

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

Changed in python-troveclient:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-troveclient (master)

Reviewed: https://review.openstack.org/157222
Committed: https://git.openstack.org/cgit/openstack/python-troveclient/commit/?id=ea9d4f912d13fef508ac772b6d9c7fc2b8e57368
Submitter: Jenkins
Branch: master

commit ea9d4f912d13fef508ac772b6d9c7fc2b8e57368
Author: Mayuri Ganguly <email address hidden>
Date: Wed Feb 18 17:20:03 2015 -0800

    Changed documentation for datastore parameter for configuration-create

    The datastore parameter for configuration-create is documented as
    optional but is required if there is no default datastore. Changed
    documentation to handle this case.

    Closes-bug 1365702

    Change-Id: I8d7869b77eeba8c5be510093d42ff6486f529b6d

Changed in python-troveclient:
status: In Progress → Fix Committed
Changed in python-troveclient:
milestone: none → 1.2.0
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.