Add support for feature.api

Despite some of the infrastructure being in place, the 'api' key in an
[operation.*] section was being ignored. This commit adds the code to
look for it so it's reported as expected in the output.

Change-Id: I36bde39742f7f3ee60ee10240d836c7083cfa0fd
This commit is contained in:
Eric Fried 2020-01-13 10:44:00 -06:00
parent ab762530f7
commit 87671feed6
5 changed files with 24 additions and 1 deletions

View File

@ -130,6 +130,11 @@ following options:
A sample CLI command that can be used to utilize the feature. A sample CLI command that can be used to utilize the feature.
``api``
:Mandatory: No
The alias for this feature in the API.
In addition, there are some driver specific options that should be repeated In addition, there are some driver specific options that should be repeated
for every driver defined earlier in the file. for every driver defined earlier in the file.
@ -166,6 +171,7 @@ For example:
notes=The attach volume operation provides a means to hotplug additional notes=The attach volume operation provides a means to hotplug additional
block storage to a running instance. block storage to a running instance.
cli=my-project attach-volume <instance> <volume> cli=my-project attach-volume <instance> <volume>
api=volume-attach
driver.slow-driver=complete driver.slow-driver=complete
driver.fast-driver=complete driver.fast-driver=complete
@ -175,6 +181,7 @@ For example:
notes=The detach volume operation provides a means to remove additional notes=The detach volume operation provides a means to remove additional
block storage from a running instance. block storage from a running instance.
cli=my-project detach-volume <instance> <volume> cli=my-project detach-volume <instance> <volume>
api=volume-detach
driver.slow-driver=complete driver.slow-driver=complete
driver-notes.slow-driver=Works without issue if instance is off. When driver-notes.slow-driver=Works without issue if instance is off. When
hotplugging, requires version foo of the driver. hotplugging, requires version foo of the driver.
@ -206,6 +213,7 @@ This is simply the combined example from above.
notes=The attach volume operation provides a means to hotplug additional notes=The attach volume operation provides a means to hotplug additional
block storage to a running instance. block storage to a running instance.
cli=my-project attach-volume <instance> <volume> cli=my-project attach-volume <instance> <volume>
api=volume-attach
driver.slow-driver=complete driver.slow-driver=complete
driver.fast-driver=complete driver.fast-driver=complete
@ -215,6 +223,7 @@ This is simply the combined example from above.
notes=The detach volume operation provides a means to remove additional notes=The detach volume operation provides a means to remove additional
block storage from a running instance. block storage from a running instance.
cli=my-project detach-volume <instance> <volume> cli=my-project detach-volume <instance> <volume>
api=volume-detach
driver.slow-driver=complete driver.slow-driver=complete
driver-notes.slow-driver=Works without issue if instance is off. When driver-notes.slow-driver=Works without issue if instance is off. When
hotplugging, requires version foo of the driver. hotplugging, requires version foo of the driver.

View File

@ -0,0 +1,4 @@
---
features:
- |
Added support for ``api`` in the feature section for an ``operation``.

View File

@ -89,10 +89,16 @@ class Matrix(object):
if cfg.has_option(section, "cli"): if cfg.has_option(section, "cli"):
cli = cfg.get(section, "cli") cli = cfg.get(section, "cli")
api = None
if cfg.has_option(section, "api"):
api = cfg.get(section, "api")
notes = None notes = None
if cfg.has_option(section, "notes"): if cfg.has_option(section, "notes"):
notes = cfg.get(section, "notes") notes = cfg.get(section, "notes")
return Feature(section, title, status, group, notes, cli) return Feature(
section, title,
status=status, group=group, notes=notes, cli=cli, api=api)
def _process_implementation(section, option, feature): def _process_implementation(section, option, feature):
if option not in self.drivers: if option not in self.drivers:

View File

@ -9,6 +9,8 @@ link=https://docs.openstack.org
[operation.Cool_Feature] [operation.Cool_Feature]
title=Cool Feature title=Cool Feature
status=optional status=optional
api=get-coolness
cli=openstack get coolness *
notes=A pretty darn cool feature. notes=A pretty darn cool feature.
driver.foo=complete driver.foo=complete
driver.bar=partial driver.bar=partial

View File

@ -51,6 +51,8 @@ class MatrixTestCase(base.TestCase):
fake_feature = self.matrix.features[0] fake_feature = self.matrix.features[0]
self.assertEqual('Cool Feature', fake_feature.title) self.assertEqual('Cool Feature', fake_feature.title)
self.assertEqual('optional', fake_feature.status) self.assertEqual('optional', fake_feature.status)
self.assertEqual('openstack get coolness *', fake_feature.cli)
self.assertEqual('get-coolness', fake_feature.api)
self.assertEqual('A pretty darn cool feature.', self.assertEqual('A pretty darn cool feature.',
fake_feature.notes) fake_feature.notes)