From 9dbd6d12e333920360fd36aa90c108c3bbae203a Mon Sep 17 00:00:00 2001
From: Adrian Andreias <adrian@fleio.com>
Date: Fri, 29 Oct 2021 22:35:49 +0300
Subject: [PATCH] docs: Get release name dynamically

Address comments in https://review.opendev.org/c/openstack/kolla-ansible/+/815043

Related-Bug: #1844710
Change-Id: Ibe51db5060e8d809539f5e929a65f285e0f7d343
Signed-off-by: Adrian Andreias <adrian@fleio.com>
---
 doc/source/conf.py                  | 14 ++++++------
 doc/source/user/operating-kolla.rst | 35 ++++++++++++++++-------------
 doc/source/user/quickstart.rst      |  8 ++-----
 3 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/doc/source/conf.py b/doc/source/conf.py
index 620cb84a7..cdfac985f 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -15,6 +15,9 @@
 import os
 import sys
 
+import openstackdocstheme
+
+
 sys.path.insert(0, os.path.abspath('../..'))
 # -- General configuration ----------------------------------------------------
 
@@ -115,18 +118,15 @@ openstack_projects = [
 # For replacement, use in docs as |VAR_NAME| (note there's no space around variable name)
 # When adding new variables, make sure you add them to GLOBAL_VARIABLE_MAP dictionary as well
 
-KOLLA_ANSIBLE_MAJOR_VERSION = '9'
-
-# use 'master' or release name, e.g. 'victoria', 'xena' etc.
-KOLLA_OPENSTACK_RELEASE = 'master'
+KOLLA_OPENSTACK_RELEASE = openstackdocstheme.ext._get_series_name()
 
-if KOLLA_OPENSTACK_RELEASE == 'master':
-    KOLLA_BRANCH_NAME = KOLLA_OPENSTACK_RELEASE
+if KOLLA_OPENSTACK_RELEASE == 'latest':
+    KOLLA_OPENSTACK_RELEASE = 'master'
+    KOLLA_BRANCH_NAME = 'master'
 else:
     KOLLA_BRANCH_NAME = 'stable/{}'.format(KOLLA_OPENSTACK_RELEASE)
 
 GLOBAL_VARIABLE_MAP = {
-    "|KOLLA_ANSIBLE_MAJOR_VERSION|": KOLLA_ANSIBLE_MAJOR_VERSION,
     "|KOLLA_OPENSTACK_RELEASE|": KOLLA_OPENSTACK_RELEASE,
     "|KOLLA_BRANCH_NAME|": KOLLA_BRANCH_NAME,
 }
diff --git a/doc/source/user/operating-kolla.rst b/doc/source/user/operating-kolla.rst
index 98543a728..080ac4054 100644
--- a/doc/source/user/operating-kolla.rst
+++ b/doc/source/user/operating-kolla.rst
@@ -22,9 +22,10 @@ release. Alpha tag usage is at discretion of the operator. The alpha identifier
 could be a number as recommended or a string of the operator's choosing.
 
 To customize the version number uncomment ``openstack_release`` in globals.yml
-and specify the version number desired. If ``openstack_release`` is not
-specified, Kolla will deploy or upgrade using the version number information
-contained in the kolla-ansible package.
+and specify the desired version number or name (e.g. ``victoria``,
+``wallaby``). If ``openstack_release`` is not specified, Kolla will deploy or
+upgrade using the version number information contained in the kolla-ansible
+package.
 
 Upgrade procedure
 ~~~~~~~~~~~~~~~~~
@@ -91,23 +92,25 @@ should be upgraded first. This will include reviewing some of the configuration
 and inventory files. On the operator/master node, a backup of the
 ``/etc/kolla`` directory may be desirable.
 
-If upgrading from ``5.0.0`` to ``6.0.0``, upgrade the kolla-ansible package:
+If upgrading to ``|KOLLA_OPENSTACK_RELEASE|``, upgrade the kolla-ansible
+package:
 
 .. code-block:: console
 
-   pip install --upgrade kolla-ansible==6.0.0
+   pip install --upgrade git+https://opendev.org/openstack/kolla-ansible@|KOLLA_BRANCH_NAME|
 
 If this is a minor upgrade, and you do not wish to upgrade kolla-ansible
 itself, you may skip this step.
 
 The inventory file for the deployment should be updated, as the newer sample
 inventory files may have updated layout or other relevant changes.
-Use the newer ``6.0.0`` one as a starting template, and merge your existing
-inventory layout into a copy of the one from here::
+Use the newer ``|KOLLA_OPENSTACK_RELEASE|`` one as a starting template, and
+merge your existing inventory layout into a copy of the one from here::
 
     /usr/share/kolla-ansible/ansible/inventory/
 
-In addition the ``6.0.0`` sample configuration files should be taken from::
+In addition the ``|KOLLA_OPENSTACK_RELEASE|`` sample configuration files should
+be taken from::
 
     # CentOS
     /usr/share/kolla-ansible/etc_examples/kolla
@@ -115,8 +118,8 @@ In addition the ``6.0.0`` sample configuration files should be taken from::
     # Ubuntu
     /usr/local/share/kolla-ansible/etc_examples/kolla
 
-At this stage, files that are still at the ``5.0.0`` version - which need
-manual updating are:
+At this stage, files that are still at the previous version and need manual
+updating are:
 
 - ``/etc/kolla/globals.yml``
 - ``/etc/kolla/passwords.yml``
@@ -126,18 +129,20 @@ template, and then replace the file in ``/etc/kolla`` with the updated version.
 For ``passwords.yml``, see the ``kolla-mergepwd`` instructions in
 `Tips and Tricks`.
 
-For the kolla docker images, the ``openstack_release`` is updated to ``6.0.0``:
+For the kolla docker images, the ``openstack_release`` is updated to
+``|KOLLA_OPENSTACK_RELEASE|``:
 
 .. code-block:: yaml
 
-   openstack_release: 6.0.0
+   openstack_release: |KOLLA_OPENSTACK_RELEASE|
 
 Once the kolla release, the inventory file, and the relevant configuration
 files have been updated in this way, the operator may first want to 'pull'
-down the images to stage the ``6.0.0`` versions. This can be done safely
-ahead of time, and does not impact the existing services. (optional)
+down the images to stage the ``|KOLLA_OPENSTACK_RELEASE|`` versions. This can
+be done safely ahead of time, and does not impact the existing services.
+(optional)
 
-Run the command to pull the ``6.0.0`` images for staging:
+Run the command to pull the ``|KOLLA_OPENSTACK_RELEASE|`` images for staging:
 
 .. code-block:: console
 
diff --git a/doc/source/user/quickstart.rst b/doc/source/user/quickstart.rst
index 9d2318c2e..161fdb7b0 100644
--- a/doc/source/user/quickstart.rst
+++ b/doc/source/user/quickstart.rst
@@ -149,23 +149,19 @@ Install Kolla-ansible
 Install Kolla-ansible for deployment or evaluation
 --------------------------------------------------
 
-For a list of ``kolla-ansible`` versions compatible with each OpenStack release
-see `Kolla Ansible release notes
-<https://docs.openstack.org/releasenotes/kolla-ansible/>`__.
-
 #. Install kolla-ansible and its dependencies using ``pip``.
 
    If using a virtual environment:
 
    .. code-block:: console
 
-      pip install 'kolla-ansible == |KOLLA_ANSIBLE_MAJOR_VERSION|.*'
+      pip install git+https://opendev.org/openstack/kolla-ansible@|KOLLA_BRANCH_NAME|
 
    If not using a virtual environment:
 
    .. code-block:: console
 
-      sudo pip3 install 'kolla-ansible == |KOLLA_ANSIBLE_MAJOR_VERSION|.*'
+      sudo pip3 install git+https://opendev.org/openstack/kolla-ansible@|KOLLA_BRANCH_NAME|
 
 #. Create the ``/etc/kolla`` directory.
 
-- 
GitLab