Support bash-completion for non-UUID IDs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-novaclient |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Python-Novaclient currently support bash-completion against UUIDs and human-friendly IDs.
Some resources, like Flavors, may have non-UUID ID's though, like `performance-123` or `gpu-1gb`.
It'd be nice if we could tab-complete against these as well.
Two modifications need to be made to achieve this:
1. We need to modify Oslo's apiclient/
2. We need to refactor the Python-client bash-completion code to not care what cache-type it's writing to. Currently it hard-codes in `uuid` and `human_id` [1] but there's no technical reason it has to. For flexibility, the code should be made `cache_type` agnostic, so if we come along and want to write to a `extra-fancy-id` cache, we could.
[1] It does this by requiring the completion-cache context-managers to specify the `cache_type`:
with completion_
with completion_
We should change it to be:
with completion_
write_
Changed in python-novaclient: | |
milestone: | none → 2.18.0 |
Changed in python-novaclient: | |
status: | Fix Committed → Fix Released |
Reviewed: https:/ /review. openstack. org/101373 /git.openstack. org/cgit/ openstack/ python- novaclient/ commit/ ?id=4c8cefb98a4 25382204df2f38f 24e6b5b71520dd
Committed: https:/
Submitter: Jenkins
Branch: master
commit 4c8cefb98a42538 2204df2f38f24e6 b5b71520dd
Author: Rick Harris <email address hidden>
Date: Thu Jun 19 18:34:17 2014 -0500
Overhaul bash-completion to support non-UUID based IDs
There are a few things currently wrong with bash-completion as it stands now:
1) IDs are currently required to be UUIDs. This is an arbitrary limitation
and doesn't make sense for certain kinds of objects, like `Flavors`
where a valid ID could be `performance-16gb`.
2) The code is spread out between Oslo's `Resource` and Novaclient's
`Manager` class. This makes it difficult to improve the code because it
requires changes to two separate projects. We should centralize the
code in Novaclient until the API is stable, then import the code into
Oslo in its entirety, not partially like it is now.
3) The completion code is handled by the `Manager` of which there is one
per Resource-type. In the interest of centralizing this functionality,
we should create a `CompletionCache` class and hang it off of `Client`
of which there is one-per-session.
4) The completion-code currently runs by default even in headless mode
(e.g. novaclient without the shell). It'd be much more efficient to
only write to the completion cache if we're accessing the `Client` from
the novaclient shell. We can make this an option to support third-party
CLI clients that want to use the completion-cache as well.
NOTE:
* The corresponding Oslo patch is here:
https:/ /review. openstack. org/#/c/ 101376/
* This patch was tested in multithreaded mode to prevent any regression
from:
https:/ /bugs.launchpad .net/python- novaclient/ +bug/1213958.
Change-Id: Idada83de103358 974b739f81d4f39 2574f9e1237
Closes-Bug: 1332270