From 87671feed656a1272c4887ded0fe5781ce8e0268 Mon Sep 17 00:00:00 2001 From: Eric Fried Date: Mon, 13 Jan 2020 10:44:00 -0600 Subject: [PATCH] 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 --- doc/source/user/index.rst | 9 +++++++++ releasenotes/notes/feature.api-e95e2d6304b0e25e.yaml | 4 ++++ sphinx_feature_classification/support_matrix.py | 8 +++++++- .../tests/fakes/support-matrix.ini | 2 ++ .../tests/test_sphinx_feature_classification.py | 2 ++ 5 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/feature.api-e95e2d6304b0e25e.yaml diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst index a6c35d0..d76806d 100644 --- a/doc/source/user/index.rst +++ b/doc/source/user/index.rst @@ -130,6 +130,11 @@ following options: 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 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 block storage to a running instance. cli=my-project attach-volume + api=volume-attach driver.slow-driver=complete driver.fast-driver=complete @@ -175,6 +181,7 @@ For example: notes=The detach volume operation provides a means to remove additional block storage from a running instance. cli=my-project detach-volume + api=volume-detach driver.slow-driver=complete driver-notes.slow-driver=Works without issue if instance is off. When 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 block storage to a running instance. cli=my-project attach-volume + api=volume-attach driver.slow-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 block storage from a running instance. cli=my-project detach-volume + api=volume-detach driver.slow-driver=complete driver-notes.slow-driver=Works without issue if instance is off. When hotplugging, requires version foo of the driver. diff --git a/releasenotes/notes/feature.api-e95e2d6304b0e25e.yaml b/releasenotes/notes/feature.api-e95e2d6304b0e25e.yaml new file mode 100644 index 0000000..03efd17 --- /dev/null +++ b/releasenotes/notes/feature.api-e95e2d6304b0e25e.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Added support for ``api`` in the feature section for an ``operation``. diff --git a/sphinx_feature_classification/support_matrix.py b/sphinx_feature_classification/support_matrix.py index 65b5a13..fd4c401 100644 --- a/sphinx_feature_classification/support_matrix.py +++ b/sphinx_feature_classification/support_matrix.py @@ -89,10 +89,16 @@ class Matrix(object): if cfg.has_option(section, "cli"): cli = cfg.get(section, "cli") + api = None + if cfg.has_option(section, "api"): + api = cfg.get(section, "api") + notes = None if cfg.has_option(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): if option not in self.drivers: diff --git a/sphinx_feature_classification/tests/fakes/support-matrix.ini b/sphinx_feature_classification/tests/fakes/support-matrix.ini index 52a5197..4e6c4e1 100644 --- a/sphinx_feature_classification/tests/fakes/support-matrix.ini +++ b/sphinx_feature_classification/tests/fakes/support-matrix.ini @@ -9,6 +9,8 @@ link=https://docs.openstack.org [operation.Cool_Feature] title=Cool Feature status=optional +api=get-coolness +cli=openstack get coolness * notes=A pretty darn cool feature. driver.foo=complete driver.bar=partial diff --git a/sphinx_feature_classification/tests/test_sphinx_feature_classification.py b/sphinx_feature_classification/tests/test_sphinx_feature_classification.py index 0ccb256..b385073 100644 --- a/sphinx_feature_classification/tests/test_sphinx_feature_classification.py +++ b/sphinx_feature_classification/tests/test_sphinx_feature_classification.py @@ -51,6 +51,8 @@ class MatrixTestCase(base.TestCase): fake_feature = self.matrix.features[0] self.assertEqual('Cool Feature', fake_feature.title) 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.', fake_feature.notes)