init
This commit is contained in:
		
							
								
								
									
										6
									
								
								.coveragerc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								.coveragerc
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
			
		||||
[run]
 | 
			
		||||
branch = True
 | 
			
		||||
source = otc-metadata
 | 
			
		||||
 | 
			
		||||
[report]
 | 
			
		||||
ignore_errors = True
 | 
			
		||||
							
								
								
									
										64
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,64 @@
 | 
			
		||||
# Add patterns in here to exclude files created by tools integrated with this
 | 
			
		||||
# repository, such as test frameworks from the project's recommended workflow,
 | 
			
		||||
# rendered documentation and package builds.
 | 
			
		||||
#
 | 
			
		||||
# Don't add patterns to exclude files created by preferred personal tools
 | 
			
		||||
# (editors, IDEs, your operating system itself even). These should instead be
 | 
			
		||||
# maintained outside the repository, for example in a ~/.gitignore file added
 | 
			
		||||
# with:
 | 
			
		||||
#
 | 
			
		||||
# git config --global core.excludesfile '~/.gitignore'
 | 
			
		||||
 | 
			
		||||
# Bytecompiled Python
 | 
			
		||||
*.py[cod]
 | 
			
		||||
 | 
			
		||||
# C extensions
 | 
			
		||||
*.so
 | 
			
		||||
 | 
			
		||||
# Packages
 | 
			
		||||
*.egg*
 | 
			
		||||
*.egg-info
 | 
			
		||||
dist
 | 
			
		||||
build
 | 
			
		||||
eggs
 | 
			
		||||
parts
 | 
			
		||||
bin
 | 
			
		||||
var
 | 
			
		||||
sdist
 | 
			
		||||
develop-eggs
 | 
			
		||||
.installed.cfg
 | 
			
		||||
lib
 | 
			
		||||
lib64
 | 
			
		||||
 | 
			
		||||
# Installer logs
 | 
			
		||||
pip-log.txt
 | 
			
		||||
 | 
			
		||||
# Unit test / coverage reports
 | 
			
		||||
cover/
 | 
			
		||||
.coverage*
 | 
			
		||||
!.coveragerc
 | 
			
		||||
.tox
 | 
			
		||||
nosetests.xml
 | 
			
		||||
.testrepository
 | 
			
		||||
.stestr
 | 
			
		||||
.venv
 | 
			
		||||
 | 
			
		||||
# Translations
 | 
			
		||||
*.mo
 | 
			
		||||
 | 
			
		||||
# Complexity
 | 
			
		||||
output/*.html
 | 
			
		||||
output/*/index.html
 | 
			
		||||
 | 
			
		||||
# Sphinx
 | 
			
		||||
doc/build
 | 
			
		||||
 | 
			
		||||
# pbr generates these
 | 
			
		||||
AUTHORS
 | 
			
		||||
ChangeLog
 | 
			
		||||
 | 
			
		||||
# Files created by releasenotes build
 | 
			
		||||
releasenotes/build
 | 
			
		||||
 | 
			
		||||
bindep.txt
 | 
			
		||||
packages.txt
 | 
			
		||||
							
								
								
									
										4
									
								
								.gitreview
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.gitreview
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
[gerrit]
 | 
			
		||||
host=review.opendev.org
 | 
			
		||||
port=29418
 | 
			
		||||
project=infra/ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git.git
 | 
			
		||||
							
								
								
									
										3
									
								
								.stestr.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.stestr.conf
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
[DEFAULT]
 | 
			
		||||
test_path=./otc_metadata/tests/
 | 
			
		||||
top_dir=./
 | 
			
		||||
							
								
								
									
										3
									
								
								CONTRIBUTING.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								CONTRIBUTING.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
The source repository for this project can be found at:
 | 
			
		||||
 | 
			
		||||
   https://github.com/infra/ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata-rework.git
 | 
			
		||||
							
								
								
									
										54
									
								
								README.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								README.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,54 @@
 | 
			
		||||
============
 | 
			
		||||
otc-metadata
 | 
			
		||||
============
 | 
			
		||||
 | 
			
		||||
Link: ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Metadata about OTC for Ecosystem
 | 
			
		||||
 | 
			
		||||
Please fill here a long description which must be at least 3 lines wrapped on
 | 
			
		||||
80 cols, so that distribution package maintainers can use it in their packages.
 | 
			
		||||
Note that this is a hard requirement.
 | 
			
		||||
 | 
			
		||||
* Free software: Apache license
 | 
			
		||||
* Documentation: https://docs.otc.t-systems.com/ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git
 | 
			
		||||
* Source: https://github.com/infra/ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git
 | 
			
		||||
 | 
			
		||||
Features
 | 
			
		||||
========
 | 
			
		||||
 | 
			
		||||
* TODO
 | 
			
		||||
 | 
			
		||||
Overview: service.yaml
 | 
			
		||||
======================
 | 
			
		||||
 | 
			
		||||
The :code:`service.yaml` file contains all data about services, service
 | 
			
		||||
categories and the related documents of each service. The file is
 | 
			
		||||
used as a base for several internal and external applications or
 | 
			
		||||
websites like the Helpcenter 3.0 where the information about the document
 | 
			
		||||
repositories and its properties are stored.
 | 
			
		||||
 | 
			
		||||
File structure
 | 
			
		||||
--------------
 | 
			
		||||
 | 
			
		||||
The file is based on the yaml-file format and has three main sections
 | 
			
		||||
which can be compared with database tables in a relational database.
 | 
			
		||||
 | 
			
		||||
* documents: contains the information about every single document and its type
 | 
			
		||||
  like umn, api-ref etc.
 | 
			
		||||
 | 
			
		||||
* service category: contains the keyword and title of the service category
 | 
			
		||||
 | 
			
		||||
* services: contains the repository information about the internal (Gitea) and
 | 
			
		||||
  external location (GitHub) and all the necessary parameters of the service itself
 | 
			
		||||
 | 
			
		||||
These sections, or better "tables" have
 | 
			
		||||
their own keys and foreign keys so that the tables are linked together and
 | 
			
		||||
the related information can be fetched.
 | 
			
		||||
For the :code:`services` table
 | 
			
		||||
the key is :code:`service_type` which has the foreign key in the
 | 
			
		||||
:code:`documents` table. So a service can have multiple documents and each
 | 
			
		||||
document can only be linked to one service.
 | 
			
		||||
The key :code:`service_category` table is :code:`name` of the service category
 | 
			
		||||
which is then used in the :code:`services` table as foreign key.
 | 
			
		||||
							
								
								
									
										4
									
								
								doc/requirements.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								doc/requirements.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
sphinx>=2.0.0,!=2.1.0 # BSD
 | 
			
		||||
otcdocstheme>=1.0.0 # Apache-2.0
 | 
			
		||||
# releasenotes
 | 
			
		||||
reno>=3.1.0 # Apache-2.0
 | 
			
		||||
							
								
								
									
										5
									
								
								doc/source/admin/index.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								doc/source/admin/index.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
====================
 | 
			
		||||
Administrators guide
 | 
			
		||||
====================
 | 
			
		||||
 | 
			
		||||
Administrators guide of ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git.
 | 
			
		||||
							
								
								
									
										5
									
								
								doc/source/cli/index.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								doc/source/cli/index.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
================================
 | 
			
		||||
Command line interface reference
 | 
			
		||||
================================
 | 
			
		||||
 | 
			
		||||
CLI reference of ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git.
 | 
			
		||||
							
								
								
									
										76
									
								
								doc/source/conf.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										76
									
								
								doc/source/conf.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,76 @@
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 | 
			
		||||
# implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
sys.path.insert(0, os.path.abspath('../..'))
 | 
			
		||||
# -- General configuration ----------------------------------------------------
 | 
			
		||||
 | 
			
		||||
# Add any Sphinx extension module names here, as strings. They can be
 | 
			
		||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 | 
			
		||||
extensions = [
 | 
			
		||||
    'sphinx.ext.autodoc',
 | 
			
		||||
    'otcdocstheme',
 | 
			
		||||
    #'sphinx.ext.intersphinx',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
# autodoc generation is a bit aggressive and a nuisance when doing heavy
 | 
			
		||||
# text edit cycles.
 | 
			
		||||
# execute "export SPHINX_DEBUG=1" in your terminal to disable
 | 
			
		||||
 | 
			
		||||
# The suffix of source filenames.
 | 
			
		||||
source_suffix = '.rst'
 | 
			
		||||
 | 
			
		||||
# The master toctree document.
 | 
			
		||||
master_doc = 'index'
 | 
			
		||||
 | 
			
		||||
# General information about the project.
 | 
			
		||||
project = 'ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git'
 | 
			
		||||
copyright = '2022, Open Telekom Cloud Developers'
 | 
			
		||||
 | 
			
		||||
# If true, '()' will be appended to :func: etc. cross-reference text.
 | 
			
		||||
add_function_parentheses = True
 | 
			
		||||
 | 
			
		||||
# If true, the current module name will be prepended to all description
 | 
			
		||||
# unit titles (such as .. function::).
 | 
			
		||||
add_module_names = True
 | 
			
		||||
 | 
			
		||||
# The name of the Pygments (syntax highlighting) style to use.
 | 
			
		||||
pygments_style = 'native'
 | 
			
		||||
 | 
			
		||||
# -- Options for HTML output --------------------------------------------------
 | 
			
		||||
 | 
			
		||||
# The theme to use for HTML and HTML Help pages.  Major themes that come with
 | 
			
		||||
# Sphinx are currently 'default' and 'sphinxdoc'.
 | 
			
		||||
# html_theme_path = ["."]
 | 
			
		||||
# html_theme = '_theme'
 | 
			
		||||
# html_static_path = ['static']
 | 
			
		||||
html_theme = 'otcdocs'
 | 
			
		||||
 | 
			
		||||
# Output file base name for HTML help builder.
 | 
			
		||||
htmlhelp_basename = '%sdoc' % project
 | 
			
		||||
 | 
			
		||||
# Grouping the document tree into LaTeX files. List of tuples
 | 
			
		||||
# (source start file, target name, title, author, documentclass
 | 
			
		||||
# [howto/manual]).
 | 
			
		||||
latex_documents = [
 | 
			
		||||
    ('index',
 | 
			
		||||
     '%s.tex' % project,
 | 
			
		||||
     '%s Documentation' % project,
 | 
			
		||||
     'Open Telekom Cloud Developers', 'manual'),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
# Example configuration for intersphinx: refer to the Python standard library.
 | 
			
		||||
#intersphinx_mapping = {'http://docs.python.org/': None}
 | 
			
		||||
							
								
								
									
										5
									
								
								doc/source/configuration/index.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								doc/source/configuration/index.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
=============
 | 
			
		||||
Configuration
 | 
			
		||||
=============
 | 
			
		||||
 | 
			
		||||
Configuration of ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git.
 | 
			
		||||
							
								
								
									
										5
									
								
								doc/source/contributor/contributing.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								doc/source/contributor/contributing.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
============================
 | 
			
		||||
So You Want to Contribute...
 | 
			
		||||
============================
 | 
			
		||||
 | 
			
		||||
TODO
 | 
			
		||||
							
								
								
									
										9
									
								
								doc/source/contributor/index.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								doc/source/contributor/index.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
===========================
 | 
			
		||||
 Contributor Documentation
 | 
			
		||||
===========================
 | 
			
		||||
 | 
			
		||||
.. toctree::
 | 
			
		||||
   :maxdepth: 2
 | 
			
		||||
 | 
			
		||||
   contributing
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								doc/source/index.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								doc/source/index.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
			
		||||
.. ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git documentation master file, created by
 | 
			
		||||
   sphinx-quickstart on Tue Jul  9 22:26:36 2013.
 | 
			
		||||
   You can adapt this file completely to your liking, but it should at least
 | 
			
		||||
   contain the root `toctree` directive.
 | 
			
		||||
 | 
			
		||||
============================================
 | 
			
		||||
Welcome to the documentation of otc-metadata
 | 
			
		||||
============================================
 | 
			
		||||
 | 
			
		||||
Contents:
 | 
			
		||||
 | 
			
		||||
.. toctree::
 | 
			
		||||
   :maxdepth: 2
 | 
			
		||||
 | 
			
		||||
   readme
 | 
			
		||||
   install/index
 | 
			
		||||
   library/index
 | 
			
		||||
   contributor/index
 | 
			
		||||
   configuration/index
 | 
			
		||||
   cli/index
 | 
			
		||||
   user/index
 | 
			
		||||
   admin/index
 | 
			
		||||
   reference/index
 | 
			
		||||
 | 
			
		||||
Indices and tables
 | 
			
		||||
==================
 | 
			
		||||
 | 
			
		||||
* :ref:`genindex`
 | 
			
		||||
* :ref:`modindex`
 | 
			
		||||
* :ref:`search`
 | 
			
		||||
							
								
								
									
										14
									
								
								doc/source/install/index.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								doc/source/install/index.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
			
		||||
================================================
 | 
			
		||||
 {{cookiecutter.module_name}} installation guide
 | 
			
		||||
================================================
 | 
			
		||||
 | 
			
		||||
.. toctree::
 | 
			
		||||
   :maxdepth: 2
 | 
			
		||||
 | 
			
		||||
   install.rst
 | 
			
		||||
 | 
			
		||||
The otc-metadata provides...
 | 
			
		||||
 | 
			
		||||
This chapter assumes a working setup of OpenStack following the
 | 
			
		||||
`OpenStack Installation Tutorial
 | 
			
		||||
<https://docs.openstack.org/project-install-guide/ocata/>`_.
 | 
			
		||||
							
								
								
									
										13
									
								
								doc/source/install/install.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								doc/source/install/install.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
.. _install:
 | 
			
		||||
 | 
			
		||||
Install and configure
 | 
			
		||||
~~~~~~~~~~~~~~~~~~~~~
 | 
			
		||||
 | 
			
		||||
This section describes how to install and configure the
 | 
			
		||||
otc-metadata.
 | 
			
		||||
 | 
			
		||||
This section assumes that you already have a working OpenStack
 | 
			
		||||
environment with at least the following components installed:
 | 
			
		||||
.. (add the appropriate services here and further notes)
 | 
			
		||||
 | 
			
		||||
Note that installation and configuration vary by distribution.
 | 
			
		||||
							
								
								
									
										7
									
								
								doc/source/library/index.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								doc/source/library/index.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
========
 | 
			
		||||
Usage
 | 
			
		||||
========
 | 
			
		||||
 | 
			
		||||
To use ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git in a project::
 | 
			
		||||
 | 
			
		||||
    import otc-metadata
 | 
			
		||||
							
								
								
									
										1
									
								
								doc/source/readme.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								doc/source/readme.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
.. include:: ../../README.rst
 | 
			
		||||
							
								
								
									
										5
									
								
								doc/source/reference/index.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								doc/source/reference/index.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
==========
 | 
			
		||||
References
 | 
			
		||||
==========
 | 
			
		||||
 | 
			
		||||
References of ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git.
 | 
			
		||||
							
								
								
									
										5
									
								
								doc/source/user/index.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								doc/source/user/index.rst
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
===========
 | 
			
		||||
Users guide
 | 
			
		||||
===========
 | 
			
		||||
 | 
			
		||||
Users guide of ssh://git@gitea.eco.tsi-dev.otc-service.com:2222/infra/otc-metadata.git.
 | 
			
		||||
							
								
								
									
										35
									
								
								otc_metadata/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								otc_metadata/__init__.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,35 @@
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
 | 
			
		||||
# not use this file except in compliance with the License. You may obtain
 | 
			
		||||
# a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
# License for the specific language governing permissions and limitations
 | 
			
		||||
# under the License.
 | 
			
		||||
__all__ = ["__version__", "Docs"]
 | 
			
		||||
 | 
			
		||||
import pbr.version
 | 
			
		||||
 | 
			
		||||
from otc_metadata.services import Services  # flake8: noqa
 | 
			
		||||
 | 
			
		||||
__version__ = pbr.version.VersionInfo("otc-metadata").version_string()
 | 
			
		||||
_service_manager = None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_service_data(*args, **kwargs):
 | 
			
		||||
    """Return singleton instance of the Services object.
 | 
			
		||||
    Parameters are all passed through to the
 | 
			
		||||
    :class:`~otc_metadata.services.Services` constructor.
 | 
			
		||||
    .. note::
 | 
			
		||||
      Only one singleton is kept, so if instances with different parameter
 | 
			
		||||
      values are desired, directly calling the constructor is necessary.
 | 
			
		||||
    :returns: Singleton instance of
 | 
			
		||||
        :class:`~otc_metadata.services.Services`
 | 
			
		||||
    """
 | 
			
		||||
    global _service_manager
 | 
			
		||||
    if not _service_manager:
 | 
			
		||||
        _service_manager = Services(*args, **kwargs)
 | 
			
		||||
    return _service_manager
 | 
			
		||||
							
								
								
									
										56
									
								
								otc_metadata/data/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								otc_metadata/data/__init__.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,56 @@
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 | 
			
		||||
# implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import pathlib
 | 
			
		||||
import yaml
 | 
			
		||||
 | 
			
		||||
__all__ = ["read_data"]
 | 
			
		||||
 | 
			
		||||
DATA_DIR = os.path.dirname(__file__)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def read_data(filename):
 | 
			
		||||
    """Return data that is shipped inside the Python package."""
 | 
			
		||||
 | 
			
		||||
    filepath = os.path.join(DATA_DIR, filename)
 | 
			
		||||
    with open(filepath, "r") as fd:
 | 
			
		||||
        data = yaml.safe_load(fd)
 | 
			
		||||
        # Merge data found in individual element files
 | 
			
		||||
        data.setdefault("documents", list())
 | 
			
		||||
        data.setdefault("services", list())
 | 
			
		||||
        data.setdefault("service_categories", list())
 | 
			
		||||
        for item in pathlib.Path(DATA_DIR, "documents").glob("*.yaml"):
 | 
			
		||||
            with open(item, "r") as fp:
 | 
			
		||||
                data["documents"].append(yaml.safe_load(fp))
 | 
			
		||||
        for item in pathlib.Path(DATA_DIR, "services").glob("*.yaml"):
 | 
			
		||||
            with open(item, "r") as fp:
 | 
			
		||||
                data["services"].append(yaml.safe_load(fp))
 | 
			
		||||
        for item in pathlib.Path(DATA_DIR, "service_categories").glob(
 | 
			
		||||
            "*.yaml"
 | 
			
		||||
        ):
 | 
			
		||||
            with open(item, "r") as fp:
 | 
			
		||||
                data["service_categories"].append(yaml.safe_load(fp))
 | 
			
		||||
 | 
			
		||||
        return data
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def rewrite_data(filename, data):
 | 
			
		||||
    """Rewrites data formatting it"""
 | 
			
		||||
    from ruamel.yaml import YAML
 | 
			
		||||
 | 
			
		||||
    _yaml = YAML()
 | 
			
		||||
    _yaml.indent(mapping=2, sequence=4, offset=2)
 | 
			
		||||
    filepath = os.path.join(DATA_DIR, filename)
 | 
			
		||||
    with open(filepath, "w") as fd:
 | 
			
		||||
        _yaml.dump(data, fd)
 | 
			
		||||
							
								
								
									
										10
									
								
								otc_metadata/data/documents/as-api-ref.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								otc_metadata/data/documents/as-api-ref.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
hc_location: api/as
 | 
			
		||||
html_location: docs/as/api-ref
 | 
			
		||||
link: /auto-scaling/api-ref/
 | 
			
		||||
pdf_enabled: true
 | 
			
		||||
pdf_environment: internal
 | 
			
		||||
rst_location: api-ref/source
 | 
			
		||||
service_type: as
 | 
			
		||||
title: API Reference
 | 
			
		||||
type: api-ref
 | 
			
		||||
							
								
								
									
										10
									
								
								otc_metadata/data/documents/as-dev.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								otc_metadata/data/documents/as-dev.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
hc_location: devg/as
 | 
			
		||||
html_location: docs/as/dev
 | 
			
		||||
link: /auto-scaling/dev-guide/
 | 
			
		||||
pdf_enabled: true
 | 
			
		||||
pdf_environment: internal
 | 
			
		||||
rst_location: dev_guide/source
 | 
			
		||||
service_type: as
 | 
			
		||||
title: Developer Guide
 | 
			
		||||
type: dev
 | 
			
		||||
							
								
								
									
										10
									
								
								otc_metadata/data/documents/as-umn.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								otc_metadata/data/documents/as-umn.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
hc_location: usermanual/as
 | 
			
		||||
html_location: docs/as/umn
 | 
			
		||||
link: /auto-scaling/umn/
 | 
			
		||||
pdf_enabled: true
 | 
			
		||||
pdf_environment: internal
 | 
			
		||||
rst_location: umn/source
 | 
			
		||||
service_type: as
 | 
			
		||||
title: User Guide
 | 
			
		||||
type: umn
 | 
			
		||||
							
								
								
									
										23
									
								
								otc_metadata/data/repositories/as.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								otc_metadata/data/repositories/as.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
---
 | 
			
		||||
service_type: as
 | 
			
		||||
- environment: public
 | 
			
		||||
  repo: opentelekomcloud-docs/auto-scaling
 | 
			
		||||
  type: github
 | 
			
		||||
  cloud_environments:
 | 
			
		||||
    - eu_de
 | 
			
		||||
- environment: internal
 | 
			
		||||
  repo: docs/auto-scaling
 | 
			
		||||
  type: gitea
 | 
			
		||||
    - eu_de
 | 
			
		||||
- environment: public
 | 
			
		||||
  repo: opentelekomcloud-docs-swiss/auto-scaling
 | 
			
		||||
  type: github
 | 
			
		||||
  cloud_environments:
 | 
			
		||||
    - swiss
 | 
			
		||||
- environment: internal
 | 
			
		||||
  repo: docs-swiss/auto-scaling
 | 
			
		||||
  type: gitea
 | 
			
		||||
  cloud_environments:
 | 
			
		||||
    - swiss
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3
									
								
								otc_metadata/data/service_categories/application.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								otc_metadata/data/service_categories/application.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
---
 | 
			
		||||
name: application
 | 
			
		||||
title: Application Services
 | 
			
		||||
							
								
								
									
										3
									
								
								otc_metadata/data/service_categories/big_data.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								otc_metadata/data/service_categories/big_data.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
---
 | 
			
		||||
name: big_data
 | 
			
		||||
title: Big Data and Data Analysis
 | 
			
		||||
							
								
								
									
										3
									
								
								otc_metadata/data/service_categories/compute.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								otc_metadata/data/service_categories/compute.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
---
 | 
			
		||||
name: compute
 | 
			
		||||
title: Computing
 | 
			
		||||
							
								
								
									
										3
									
								
								otc_metadata/data/service_categories/container.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								otc_metadata/data/service_categories/container.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
---
 | 
			
		||||
name: container
 | 
			
		||||
title: Container
 | 
			
		||||
							
								
								
									
										3
									
								
								otc_metadata/data/service_categories/database.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								otc_metadata/data/service_categories/database.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
---
 | 
			
		||||
name: database
 | 
			
		||||
title: Databases
 | 
			
		||||
							
								
								
									
										3
									
								
								otc_metadata/data/service_categories/md.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								otc_metadata/data/service_categories/md.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
---
 | 
			
		||||
name: md
 | 
			
		||||
title: Management & Deployment
 | 
			
		||||
							
								
								
									
										3
									
								
								otc_metadata/data/service_categories/network.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								otc_metadata/data/service_categories/network.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
---
 | 
			
		||||
name: network
 | 
			
		||||
title: Networking
 | 
			
		||||
							
								
								
									
										3
									
								
								otc_metadata/data/service_categories/other.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								otc_metadata/data/service_categories/other.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
---
 | 
			
		||||
name: other
 | 
			
		||||
title: Other
 | 
			
		||||
@ -0,0 +1,3 @@
 | 
			
		||||
---
 | 
			
		||||
name: security-services
 | 
			
		||||
title: Security Services
 | 
			
		||||
							
								
								
									
										3
									
								
								otc_metadata/data/service_categories/storage.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								otc_metadata/data/service_categories/storage.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
---
 | 
			
		||||
name: storage
 | 
			
		||||
title: Storage
 | 
			
		||||
							
								
								
									
										22
									
								
								otc_metadata/data/services.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								otc_metadata/data/services.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 | 
			
		||||
# implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
 | 
			
		||||
# Please consult with otc_metadata.services.Services:_sort_data for expected
 | 
			
		||||
# sort order. When unsure perform tools/sort_metadata.py for getting it sorted.
 | 
			
		||||
# It is also supported, that content of files under
 | 
			
		||||
# documents/services/service_categories is being merged with
 | 
			
		||||
# the content here.
 | 
			
		||||
---
 | 
			
		||||
documents: []
 | 
			
		||||
service_categories: []
 | 
			
		||||
services: []
 | 
			
		||||
							
								
								
									
										13
									
								
								otc_metadata/data/services/as.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								otc_metadata/data/services/as.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
---
 | 
			
		||||
environment: public
 | 
			
		||||
repositories:
 | 
			
		||||
service_category: compute
 | 
			
		||||
service_title: Auto Scaling
 | 
			
		||||
service_type: as
 | 
			
		||||
service_uri: auto-scaling
 | 
			
		||||
cloud_environments:
 | 
			
		||||
- name: eu_de
 | 
			
		||||
- name: swiss
 | 
			
		||||
teams:
 | 
			
		||||
- name: docs-compute-rw
 | 
			
		||||
  permission: write
 | 
			
		||||
							
								
								
									
										37
									
								
								otc_metadata/docs.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								otc_metadata/docs.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 | 
			
		||||
# implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
 | 
			
		||||
import copy
 | 
			
		||||
 | 
			
		||||
import otc_metadata.data
 | 
			
		||||
 | 
			
		||||
__all__ = ["Service"]
 | 
			
		||||
 | 
			
		||||
BUILTIN_DATA = otc_metadata.data.read_data("docs.yaml")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def _normalize_type(service_type):
 | 
			
		||||
    if service_type:
 | 
			
		||||
        return service_type.replace("_", "-")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Service(object):
 | 
			
		||||
    """Encapsulation of the OTC Docs data"""
 | 
			
		||||
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        self._service_data = BUILTIN_DATA
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def all_services(self):
 | 
			
		||||
        "Service Categories data listing."
 | 
			
		||||
        return copy.deepcopy(self._service_data["services"])
 | 
			
		||||
							
								
								
									
										308
									
								
								otc_metadata/services.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										308
									
								
								otc_metadata/services.py
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										158
									
								
								otc_metadata/templates/conf.py.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								otc_metadata/templates/conf.py.j2
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										16
									
								
								otc_metadata/templates/doc_requirements.txt.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								otc_metadata/templates/doc_requirements.txt.j2
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,16 @@
 | 
			
		||||
sphinx>=2.0.0,!=2.1.0 # BSD
 | 
			
		||||
{% if target_environment == 'public' %}
 | 
			
		||||
otcdocstheme<2.0.0 # Apache-2.0
 | 
			
		||||
{% elif target_environment == 'internal' %}
 | 
			
		||||
otcdocstheme # Apache-2.0
 | 
			
		||||
{% else %}
 | 
			
		||||
otcdocstheme # Apache-2.0
 | 
			
		||||
{% endif %}
 | 
			
		||||
# releasenotes
 | 
			
		||||
reno>=3.1.0 # Apache-2.0
 | 
			
		||||
 | 
			
		||||
otc-sphinx-directives>=0.1.0
 | 
			
		||||
sphinx-minify>=0.0.1 # Apache-2.0
 | 
			
		||||
git+https://gitea.eco.tsi-dev.otc-service.com/infra/otc-metadata.git#egg=otc_metadata
 | 
			
		||||
setuptools
 | 
			
		||||
gitpython
 | 
			
		||||
							
								
								
									
										8
									
								
								otc_metadata/templates/index_sbv.rst.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								otc_metadata/templates/index_sbv.rst.j2
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
			
		||||
{{ sbv_title }}
 | 
			
		||||
 | 
			
		||||
.. directive_wrapper::
 | 
			
		||||
   :class: container-sbv
 | 
			
		||||
 | 
			
		||||
   .. service_card::
 | 
			
		||||
      :service_type: {{ service_type }}
 | 
			
		||||
      :environment: {{ environment }}
 | 
			
		||||
							
								
								
									
										151
									
								
								otc_metadata/templates/tox.ini.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										151
									
								
								otc_metadata/templates/tox.ini.j2
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										19
									
								
								otc_metadata/templates/zuul.yaml.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								otc_metadata/templates/zuul.yaml.j2
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
---
 | 
			
		||||
- project:
 | 
			
		||||
    merge-mode: squash-merge
 | 
			
		||||
    default-branch: main
 | 
			
		||||
    templates:
 | 
			
		||||
      - helpcenter-base-jobs
 | 
			
		||||
    vars:
 | 
			
		||||
      sphinx_pdf_files:
 | 
			
		||||
      {%- for doc in docs %}
 | 
			
		||||
      {%- if doc.pdf_enabled %}
 | 
			
		||||
        - {{ service_type }}-{{ doc.type }}.pdf
 | 
			
		||||
      {%- endif %}
 | 
			
		||||
      {%- endfor %}
 | 
			
		||||
    check:
 | 
			
		||||
      jobs:
 | 
			
		||||
        - noop
 | 
			
		||||
    gate:
 | 
			
		||||
      jobs:
 | 
			
		||||
        - noop
 | 
			
		||||
							
								
								
									
										0
									
								
								otc_metadata/tests/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								otc_metadata/tests/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										70
									
								
								otc_metadata/tests/test_otc_metadata.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								otc_metadata/tests/test_otc_metadata.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,70 @@
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
 | 
			
		||||
# not use this file except in compliance with the License. You may obtain
 | 
			
		||||
# a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
# License for the specific language governing permissions and limitations
 | 
			
		||||
# under the License.
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
test_otc-metadata
 | 
			
		||||
----------------------------------
 | 
			
		||||
 | 
			
		||||
Tests for `otc-metadata` module.
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from unittest import TestCase
 | 
			
		||||
 | 
			
		||||
from otc_metadata import services
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TestOtcMetadata(TestCase):
 | 
			
		||||
    def setUp(self):
 | 
			
		||||
        self.data = services.Services()
 | 
			
		||||
 | 
			
		||||
    def test_data_is_sorted(self):
 | 
			
		||||
        curr = self.data
 | 
			
		||||
        new = services.Services()
 | 
			
		||||
        new._sort_data()
 | 
			
		||||
        self.assertEqual(
 | 
			
		||||
            curr._service_data, new._service_data, "Data is sorted properly"
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_service_categories(self):
 | 
			
		||||
        category = dict()
 | 
			
		||||
        for cat in self.data._service_data["service_categories"]:
 | 
			
		||||
            category[cat["name"]] = cat["title"]
 | 
			
		||||
        for srv in self.data.all_services:
 | 
			
		||||
            self.assertTrue(
 | 
			
		||||
                srv["service_category"] in category,
 | 
			
		||||
                f"Category {srv['service_category']} is present",
 | 
			
		||||
            )
 | 
			
		||||
        self.assertGreater(
 | 
			
		||||
            len(self.data._service_data["service_categories"]),
 | 
			
		||||
            1,
 | 
			
		||||
            "More then 1 service category",
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_doc_contains_required_data(self):
 | 
			
		||||
        srv_types = dict()
 | 
			
		||||
        for srv in self.data.all_services:
 | 
			
		||||
            srv_types[srv["service_type"]] = srv
 | 
			
		||||
        for doc in self.data.all_docs:
 | 
			
		||||
            for attr in [
 | 
			
		||||
                "rst_location",
 | 
			
		||||
                "service_type",
 | 
			
		||||
                "title",
 | 
			
		||||
                "type",
 | 
			
		||||
            ]:
 | 
			
		||||
                self.assertIn(attr, doc, f"Document {doc} contains {attr}")
 | 
			
		||||
            self.assertIn(
 | 
			
		||||
                doc["service_type"],
 | 
			
		||||
                srv_types,
 | 
			
		||||
                f"Document {doc} contains valid service_type",
 | 
			
		||||
            )
 | 
			
		||||
							
								
								
									
										0
									
								
								releasenotes/notes/.placeholder
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								releasenotes/notes/.placeholder
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								releasenotes/source/_static/.placeholder
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								releasenotes/source/_static/.placeholder
									
									
									
									
									
										Normal file
									
								
							Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user