From 305bf0bb19c08f558999ed0565debecb09e2bdde Mon Sep 17 00:00:00 2001 From: Chandan Kumar Date: Wed, 18 Jan 2017 15:18:53 +0530 Subject: [PATCH] Refactored python-tempestconf to work with devstack Change-Id: I5143d9ef63d7bf326b477110c0ff6f82b3c2a9b2 --- HACKING.rst | 2 +- README.rst | 14 ++++---- config_tempest/__init__.py | 19 ----------- config_tempest/config_tempest.py | 23 +++++-------- ...nfig_tempest.py => test_tempest_config.py} | 8 ++--- doc/source/conf.py | 4 +-- doc/source/index.rst | 4 +-- doc/source/installation.rst | 6 ++-- doc/source/usage.rst | 4 +-- releasenotes/source/conf.py | 5 ++- releasenotes/source/index.rst | 2 +- requirements.txt | 6 ++-- setup.cfg | 33 ++++++++----------- setup.py | 2 +- test-requirements.txt | 14 ++++---- tox.ini | 9 +++-- 16 files changed, 62 insertions(+), 93 deletions(-) mode change 100644 => 100755 config_tempest/config_tempest.py rename config_tempest/tests/{test_config_tempest.py => test_tempest_config.py} (83%) diff --git a/HACKING.rst b/HACKING.rst index 1999f56a..3dee85d5 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -1,4 +1,4 @@ -tempest_config_tool Style Commandments +python-tempestconf Style Commandments =============================================== Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ diff --git a/README.rst b/README.rst index 504f751c..c96b1f8a 100644 --- a/README.rst +++ b/README.rst @@ -1,17 +1,15 @@ =============================== -tempest_config_tool +python-tempestconf =============================== -OpenStack Boilerplate contains all the boilerplate you need to create an OpenStack package. +python-tempestconf will automatically generates the tempest configuration based on your cloud. + -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: http://docs.openstack.org/developer/tempest_config_tool -* Source: http://git.openstack.org/cgit/openstack/tempest_config_tool -* Bugs: http://bugs.launchpad.net/replace with the name of the project on launchpad +* Documentation: http://docs.openstack.org/developer/python-tempestconf +* Source: http://git.openstack.org/cgit/openstack/python-tempestconf +* Bugs: http://bugs.launchpad.net/python-tempestconf Features -------- diff --git a/config_tempest/__init__.py b/config_tempest/__init__.py index d2406312..e69de29b 100644 --- a/config_tempest/__init__.py +++ b/config_tempest/__init__.py @@ -1,19 +0,0 @@ -# -*- 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 pbr.version - - -__version__ = pbr.version.VersionInfo( - 'config_tempest').version_string() diff --git a/config_tempest/config_tempest.py b/config_tempest/config_tempest.py old mode 100644 new mode 100755 index 9d4e77aa..74a41d22 --- a/config_tempest/config_tempest.py +++ b/config_tempest/config_tempest.py @@ -34,34 +34,29 @@ or manually if necessary. obtained by querying the cloud. """ +import api_discovery import argparse import ConfigParser import logging import os import shutil -import sys +import tempest.config import urllib2 -# Since tempest can be configured in different directories, we need to use -# the path starting at cwd. -sys.path.insert(0, os.getcwd()) - -import config_tempest.api_discovery as api_discovery from tempest.common import identity -import tempest.config from tempest.lib import auth from tempest.lib import exceptions from tempest.lib.services.compute import flavors_client from tempest.lib.services.compute import networks_client as nova_net_client from tempest.lib.services.compute import servers_client +from tempest.lib.services.identity.v2 import identity_client +from tempest.lib.services.identity.v2 import roles_client +from tempest.lib.services.identity.v2 import tenants_client +from tempest.lib.services.identity.v2 import users_client +from tempest.lib.services.identity.v3 \ + import identity_client as identity_v3_client from tempest.lib.services.image.v2 import images_client from tempest.lib.services.network import networks_client -from tempest.services.identity.v2.json import identity_client -from tempest.services.identity.v2.json import roles_client -from tempest.services.identity.v2.json import tenants_client -from tempest.services.identity.v2.json import users_client -from tempest.services.identity.v3.json \ - import identity_client as identity_v3_client LOG = logging.getLogger(__name__) LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' @@ -776,7 +771,7 @@ def configure_discovered_services(conf, services): # set supported API versions for services with more of them for service, versions in SERVICE_VERSIONS.iteritems(): - supported_versions = services[service]['versions'] + supported_versions = services.get(service, {}).get('versions', []) section = service + '-feature-enabled' for version in versions: is_supported = any(version in item diff --git a/config_tempest/tests/test_config_tempest.py b/config_tempest/tests/test_tempest_config.py similarity index 83% rename from config_tempest/tests/test_config_tempest.py rename to config_tempest/tests/test_tempest_config.py index 20f6a554..adc07aee 100644 --- a/config_tempest/tests/test_config_tempest.py +++ b/config_tempest/tests/test_tempest_config.py @@ -13,16 +13,16 @@ # under the License. """ -test_config_tempest +test_tempest_config ---------------------------------- -Tests for `config_tempest` module. +Tests for `tempest_config` module. """ -from config_tempest.tests import base +from tempest_config.tests import base -class TestConfig_tempest(base.TestCase): +class TestTempest_config(base.TestCase): def test_something(self): pass diff --git a/doc/source/conf.py b/doc/source/conf.py index 9c67e465..ce0b1741 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -37,8 +37,8 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'tempest_config_tool' -copyright = u'2016, OpenStack Foundation' +project = u'python-tempestconf' +copyright = u'2016, Red Hat' # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True diff --git a/doc/source/index.rst b/doc/source/index.rst index 8ce40fea..dea00566 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,9 +1,9 @@ -.. tempest_config_tool documentation master file, created by +.. python-tempestconf 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 tempest_config_tool's documentation! +Welcome to python-tempestconf's documentation! ======================================================== Contents: diff --git a/doc/source/installation.rst b/doc/source/installation.rst index 400c02af..e0642bd6 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -4,9 +4,9 @@ Installation At the command line:: - $ pip install tempest_config_tool + $ pip install python-tempestconf Or, if you have virtualenvwrapper installed:: - $ mkvirtualenv tempest_config_tool - $ pip install tempest_config_tool + $ mkvirtualenv python-tempestconf + $ pip install python-tempestconf diff --git a/doc/source/usage.rst b/doc/source/usage.rst index fb87c23e..79675e1b 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -2,6 +2,6 @@ Usage ======== -To use tempest_config_tool in a project:: +To use python-tempestconf in a project:: - import config_tempest + import tempest_config diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 27534e5c..e913e96f 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -55,7 +55,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'config_tempest Release Notes' +project = u'tempest_config Release Notes' copyright = u'2016, OpenStack Foundation' # The version info for the project you're documenting, acts as replacement for @@ -270,3 +270,6 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False + +# -- Options for Internationalization output ------------------------------ +locale_dirs = ['locale/'] diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst index a1b40976..d826dbf9 100644 --- a/releasenotes/source/index.rst +++ b/releasenotes/source/index.rst @@ -1,5 +1,5 @@ ============================================ - config_tempest Release Notes + tempest_config Release Notes ============================================ .. toctree:: diff --git a/requirements.txt b/requirements.txt index 08cc592b..c882981a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,6 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -pbr>=1.6 # Apache-2.0 -requests -tempest +pbr>=1.8 # Apache-2.0 +tempest>=14.0.0 # Apache-2.0 +requests>=2.10.0,!=2.12.2 # Apache-2.0 diff --git a/setup.cfg b/setup.cfg index b348ec7a..b211dff3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,11 +1,11 @@ [metadata] -name = tempest_config_tool -summary = OpenStack Boilerplate contains all the boilerplate you need to create an OpenStack package. +name = python-tempestconf +summary = python-tempestconf will automatically generates the tempest configuration based on your cloud. description-file = README.rst -author = OpenStack -author-email = openstack-dev@lists.openstack.org -home-page = http://www.openstack.org/ +author = Red Hat +author-email = rdo-list@redhat.com +home-page = http://www.redhat.com/ classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -23,6 +23,13 @@ classifier = packages = config_tempest +data_files = + etc/tempest = etc/* + +[entry_points] +console_scripts = + discover-tempest-config = config_tempest.config_tempest:main + [build_sphinx] source-dir = doc/source build-dir = doc/build @@ -31,21 +38,7 @@ all_files = 1 [upload_sphinx] upload-dir = doc/build/html -[compile_catalog] -directory = config_tempest/locale -domain = config_tempest - -[update_catalog] -domain = config_tempest -output_dir = config_tempest/locale -input_file = config_tempest/locale/config_tempest.pot - -[extract_messages] -keywords = _ gettext ngettext l_ lazy_gettext -mapping_file = babel.cfg -output_file = config_tempest/locale/config_tempest.pot - [build_releasenotes] all_files = 1 build-dir = releasenotes/build -source-dir = releasenotes/source \ No newline at end of file +source-dir = releasenotes/source diff --git a/setup.py b/setup.py index 056c16c2..782bb21f 100644 --- a/setup.py +++ b/setup.py @@ -25,5 +25,5 @@ except ImportError: pass setuptools.setup( - setup_requires=['pbr'], + setup_requires=['pbr>=1.8'], pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index a3fcd815..4a7d2041 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,16 +2,16 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking<0.12,>=0.11.0 # Apache-2.0 +hacking>=0.12.0,<0.13 # Apache-2.0 -coverage>=3.6 # Apache-2.0 +coverage>=4.0 # Apache-2.0 python-subunit>=0.0.18 # Apache-2.0/BSD -sphinx!=1.3b1,<1.3,>=1.2.1 # BSD -oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 +sphinx>=1.2.1,!=1.3b1,<1.4 # BSD +oslosphinx>=4.7.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD -testscenarios>=0.4 # Apache-2.0/BSD +testrepository>=0.0.18 # Apache-2.0/BSD +testscenarios>=0.4 # Apache-2.0/BSD testtools>=1.4.0 # MIT # releasenotes -reno>=1.8.0 # Apache2 +reno>=1.8.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 2503c868..c8889926 100644 --- a/tox.ini +++ b/tox.ini @@ -5,12 +5,11 @@ skipsdist = True [testenv] usedevelop = True -install_command = pip install -U {opts} {packages} +install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} setenv = VIRTUAL_ENV={envdir} -deps = - -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt + PYTHONWARNINGS=default::DeprecationWarning +deps = -r{toxinidir}/test-requirements.txt commands = python setup.py test --slowest --testr-args='{posargs}' [testenv:pep8] @@ -23,7 +22,7 @@ commands = {posargs} commands = python setup.py test --coverage --testr-args='{posargs}' [testenv:docs] -commands = python setup.py build_sphinx {posargs} +commands = python setup.py build_sphinx [testenv:releasenotes] commands =