diff --git a/doc/source/conf.py b/doc/source/conf.py index acf14f4eb8..0dcf02ee13 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -49,6 +49,8 @@ extensions = ['sphinx.ext.coverage', 'oslosphinx', 'stevedore.sphinxext', 'oslo_config.sphinxext', + 'sphinx.ext.autodoc', + 'sphinx.ext.viewcode', ] # Add any paths that contain templates here, relative to this directory. @@ -93,7 +95,7 @@ version = glance_version.canonical_version_string() # List of directories, relative to source directory, that shouldn't be searched # for source files. -exclude_trees = ['api'] +#exclude_trees = ['api'] exclude_patterns = [ # The man directory includes some snippet files that are included # in other documents during the build but that should not be @@ -112,7 +114,7 @@ exclude_patterns = [ # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. @@ -209,10 +211,10 @@ html_last_updated_fmt = subprocess.Popen(git_cmd, #html_additional_pages = {} # If false, no module index is generated. -html_use_modindex = False +html_use_modindex = True # If false, no index is generated. -html_use_index = False +html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False diff --git a/doc/source/index.rst b/doc/source/index.rst index 3317e672ad..e876e470cc 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -106,6 +106,7 @@ Glance Manual Pages :maxdepth: 1 man/* + api/modules Contributing to Glance ====================== @@ -114,3 +115,10 @@ Contributing to Glance :maxdepth: 1 contributing/index + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` \ No newline at end of file diff --git a/glance/contrib/plugins/image_artifact/v2/image.py b/glance/contrib/plugins/image_artifact/v2/image.py index c0080ea4ed..52831fde21 100644 --- a/glance/contrib/plugins/image_artifact/v2/image.py +++ b/glance/contrib/plugins/image_artifact/v2/image.py @@ -16,7 +16,13 @@ from glance.common import exception from glance.common.glare import definitions import glance.contrib.plugins.image_artifact.v1_1.image as v1_1 -import glanceclient +# Since this is not in the test-requirements.txt and the class below, +# ImageAsAnArtifact, is pending removal a try except is added to prevent +# an ImportError when module docs are generated +try: + import glanceclient +except ImportError: + glanceclient = None from glance.i18n import _ @@ -47,6 +53,11 @@ class ImageAsAnArtifact(v1_1.ImageAsAnArtifact): glance_endpoint = next(service['endpoints'][0]['publicURL'] for service in context.service_catalog if service['name'] == 'glance') + # Ensure glanceclient is imported correctly since we are catching + # the ImportError on initialization + if glanceclient == None: + raise ImportError(_("Glance client not installed")) + try: client = glanceclient.Client(version=2, endpoint=glance_endpoint, diff --git a/setup.cfg b/setup.cfg index ac2e0cd5c9..932619d516 100644 --- a/setup.cfg +++ b/setup.cfg @@ -86,3 +86,4 @@ output_file = glance/locale/glance.pot [pbr] warnerrors = True +autodoc_tree_index_modules = True \ No newline at end of file