[docs] Use proper reference for openstack plugins

* add rally-openstack package to doc requirements
* fix linking for plugins (with hardcoding openstack plugins)
* move importing of osclients to inner methods

Change-Id: Ifb851c61de01e4140c23b447b5e0d55c1e76fb1c
This commit is contained in:
Andrey Kurilin 2018-04-19 16:37:55 +03:00
parent 44aaa7dfed
commit 8eaed0befe
6 changed files with 24 additions and 5 deletions

View File

@ -306,7 +306,15 @@ class PluginsReferenceDirective(rst.Directive):
section_obj.extend(utils.parse_text(section))
filename = info["module"].replace(".", "/")
ref = "https://github.com/openstack/rally/blob/master/%s.py" % filename
if filename.startswith("rally/"):
project = "rally"
elif filename.startswith("rally_openstack/"):
project = "rally-openstack"
else:
# WTF is it?!
return None
ref = ("https://github.com/openstack/%s/blob/master/%s.py"
% (project, filename))
section_obj.extend(utils.parse_text("**Module**:\n`%s`__\n\n__ %s"
% (info["module"], ref)))
return section_obj
@ -336,6 +344,7 @@ class PluginsReferenceDirective(rst.Directive):
name += word
return name
@plugins.ensure_plugins_are_loaded
def _get_all_plugins_bases(self):
"""Return grouped and sorted all plugins bases."""
bases = []
@ -357,7 +366,6 @@ class PluginsReferenceDirective(rst.Directive):
return sorted(bases)
def run(self):
plugins.load()
bases = self._get_all_plugins_bases()
if "base_cls" in self.options:
for _category_name, base_name, base_cls in bases:

3
doc/requirements.txt Normal file
View File

@ -0,0 +1,3 @@
rally-openstack
# we are using theme from it
oslosphinx

View File

@ -14,7 +14,6 @@
# under the License.
from rally.common import logging
from rally.plugins.openstack import osclients
LOG = logging.getLogger(__file__)
@ -87,6 +86,8 @@ class OpenStackCredential(dict):
# this method is mostly used by validation step. let's refactor it and
# deprecated this
def clients(self, api_info=None):
from rally.plugins.openstack import osclients
return osclients.Clients(self, api_info=api_info,
cache=self._clients_cache)

View File

@ -22,7 +22,6 @@ import six
from rally.common.plugin import plugin
from rally import exceptions
from rally.plugins.openstack import osclients
from rally.task import scenario
@ -86,6 +85,8 @@ def preprocess(name, context, args):
and resource configuration
"""
from rally.plugins.openstack import osclients
preprocessors = scenario.Scenario.get(name)._meta_get("preprocessors",
default={})

View File

@ -95,7 +95,7 @@ class ConvertTestCase(test.TestCase):
class PreprocessTestCase(test.TestCase):
@mock.patch("rally.task.types.scenario.Scenario.get")
@mock.patch("rally.task.types.osclients")
@mock.patch("rally.plugins.openstack.osclients")
def test_preprocess(self, mock_osclients, mock_scenario_get):
name = "some_plugin"

View File

@ -80,6 +80,12 @@ changedir = doc/source
commands =
rm -rf _build
make html
deps =
-c{toxinidir}/upper-constraints.txt
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
[testenv:genconfig]
commands =