From 682e8b479a3eeddf9c7f2a4451efa0c4149858c6 Mon Sep 17 00:00:00 2001
From: Stephen Finucane <sfinucan@redhat.com>
Date: Wed, 17 Jan 2018 10:03:51 +0000
Subject: [PATCH] Fix openstackdocstheme options for api-ref

Initialize the parameter for current openstackdocstheme so that report a
bug feature works and displays all parameter including git URL and SHA.

We need to add openstackdocstheme as extension so that the parameter are
properly initialized. html_context is not needed anymore. The display of
time of last commit is done by openstackdocstheme.

Change-Id: Ic46f5ff6bc42b48ce9de5f5bf3a2193ed75fb063
Closes-Bug: #1743728
---
 placement-api-ref/source/conf.py | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/placement-api-ref/source/conf.py b/placement-api-ref/source/conf.py
index 80a4a5f96..172670742 100644
--- a/placement-api-ref/source/conf.py
+++ b/placement-api-ref/source/conf.py
@@ -25,23 +25,18 @@
 # serve to show the default.
 
 import os
-import subprocess
 import sys
-import warnings
 
-import openstackdocstheme
 
 extensions = [
+    'openstackdocstheme',
     'os_api_ref',
 ]
 
-
 html_theme = 'openstackdocs'
-html_theme_path = [openstackdocstheme.get_html_theme_path()]
 html_theme_options = {
     "sidebar_mode": "toc",
 }
-html_context = {'bug_project': 'nova', 'bug_tag': 'placement-api-ref'}
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -69,6 +64,11 @@ master_doc = 'index'
 project = u'Placement API Reference'
 copyright = u'2010-present, OpenStack Foundation'
 
+# openstackdocstheme options
+repository_name = 'openstack/nova'
+bug_project = 'nova'
+bug_tag = 'placement-api-ref'
+
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
@@ -152,14 +152,7 @@ pygments_style = 'sphinx'
 
 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
 # using the given strftime format.
-# html_last_updated_fmt = '%b %d, %Y'
-git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
-    "-n1"]
-try:
-    html_last_updated_fmt = subprocess.check_output(git_cmd).decode('utf-8')
-except Exception:
-    warnings.warn('Cannot get last updated time from git repository. '
-                  'Not setting "html_last_updated_fmt".')
+html_last_updated_fmt = '%Y-%m-%d %H:%M'
 
 # If true, SmartyPants will be used to convert quotes and dashes to
 # typographically correct entities.