trove-specs/specs/kilo/add-instance-name-to-cli.rst
Nikhil Manchanda 4a72d213aa Add unit tests for Trove specs
Add simple unit tests to the Trove specs repo which ensure that
specifications submitted follow the template correctly and address
all the needed sections.

Update tox to run these unit tests automatically.

At the beginning of each release, test_titles.py will need to be updated
and 'current_release' modified to reflect the new release directory.  At
the same time, the new release directory will be created, the index.rst
file in doc/source ammended to include this directory, and any unmerged
specs moved there.  In this way, changes to the template will only
affect specs going forward and avoids having to modify any specs that
have merged in previous releases.

(It will also have the side effect of signalling the 'opening' of the
release to new specs.)

Change-Id: I8f1175bceed63d36d96b6c6c6b4188ef27d3102e
2015-06-16 21:53:16 +00:00

3.6 KiB

Add instance name as parameter to various CLI commands

Blueprint:

https://blueprints.launchpad.net/trove/+spec/add-instance-name-to-cli

The proposal is to allow instance-name to be specified wherever instance-ID is currently used throughout the CLI.

Problem Description

Currently, only the "trove show" command will take instance-ID or instance-name as its parameter. There are many more commands in the CLI that require an instance reference as a parameter but require that the instance-ID be used. It would be helpful to customers to be able to use instance-ID or instance-name interchangeably throughtout the CLI.

Proposed Change

Allow instance-id or instance-name to be passed in for the following commands:

  • backup-create
  • backup-list-instance
  • configuration-attach
  • configuration-default
  • configuration-detach
  • database-create
  • database-delete
  • database-list
  • detach-replica
  • delete
  • metadata-create
  • metadata-delete
  • metadata-edit
  • metadata-list
  • metadata-show
  • metadata-update
  • resize-flavor
  • resize-instance
  • resize-volume
  • restart
  • root-enable
  • root-show
  • update
  • user-create
  • user-delete
  • user-grant-access
  • user-list
  • user-revoke-access
  • user-show
  • user-show-access
  • user-update-attributes

For example, trove delete currently looks like this:

usage: trove delete <instance>

Deletes an instance.

Positional arguments:
    <instance>  ID of the instance.

The proposal is to make it look like this:

usage: trove delete <instance>

Deletes an instance.

Positional arguments:
    <instance>  ID or name of the instance.

This will be a CLI change only.

Currently the trove show command will display an error if there is more than one instance with the name provided. The error indicates that, in this case, the instance ID must be used. This behavior will be preserved and used across all the commands mentioned above.

Configuration

None

Database

None

Public API

None

Public API Security

None

Internal API

None

Guest Agent

None

Alternatives

None

Implementation

Assignee(s)

Primary assignees:

  • 0-doug (dougshelley66)
  • peterstac

Milestones

Target Milestone for completion:

Kilo-2

Work Items

  1. Go through python-troveclient/troveclient/v1/shell.py and call _find_instance(cs, args.instance) ahead of the "real" work in each "do<>" method.
  2. Alter the help text in shell.py to indicate the use of name or ID.
  3. Alter the existing unit tests as appropriate.

Dependencies

None

Testing

If we had Tempest coverage for the CLI it would be adjusted to exercise passing instance name to all the altered commands. Also, there is an existing LP bug [1] that indicates we should write tests for the CLI.

Both of these are considered out of scope for this BP.

[1] https://bugs.launchpad.net/python-troveclient/+bug/1314793

Documentation Impact

The help text for the aforementioned commands will be altered to now include instance name as a valid parameter. I believe that the CLI documentation is generated from the code.

References

None