commit c29107217e66efe76b6c26539ed7aed3cdd7dce6 Author: Gael Chamoulaud (Strider) <gchamoul@redhat.com> Date: Wed Mar 4 15:10:13 2020 +0100 Initialization of validations-common Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com> diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..ecb5a81 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,7 @@ +[run] +branch = True +source = validations-common +omit = validations-common/openstack/* + +[report] +ignore_errors = True diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c71f9ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,62 @@ +*.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 +.venv + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Complexity +output/*.html +output/*/index.html + +# Sphinx +doc/build + +# pbr generates these +AUTHORS +ChangeLog + +# Editors +*~ +.*.swp +.*sw? + +# Files created by releasenotes build +releasenotes/build + +# Ansible specific +hosts +*.retry diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c161396 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,45 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.5.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + - id: mixed-line-ending + - id: check-byte-order-marker + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: debug-statements + - id: flake8 + entry: >- + flake8 --ignore=E24,E121,E122,E123,E124,E126,E226 + --ignore=E265,E305,E402,F401,F405,E501,E704,F403,F841,W503,W605 + - id: check-yaml + files: .*\.(yaml|yml)$ + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.20.0 + hooks: + - id: yamllint + files: \.(yaml|yml)$ + types: [file, yaml] + entry: yamllint --strict -f parsable + - repo: https://github.com/ansible/ansible-lint.git + rev: v4.2.0 + hooks: + - id: ansible-lint + always_run: true + pass_filenames: false + verbose: true + entry: ansible-lint --force-color -p -v + - repo: https://github.com/openstack-dev/bashate.git + rev: 0.6.0 + hooks: + - id: bashate + entry: bashate --error . --verbose --ignore=E006,E040 + # Run bashate check for all bash scripts + # Ignores the following rules: + # E006: Line longer than 79 columns (as many scripts use jinja + # templating, this is very difficult) + # E040: Syntax error determined using `bash -n` (as many scripts + # use jinja templating, this will often fail and the syntax + # error will be discovered in execution anyway) diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 0000000..6d83b3c --- /dev/null +++ b/.testr.conf @@ -0,0 +1,7 @@ +[DEFAULT] +test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ + OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ + OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ + ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION +test_id_option=--load-list $IDFILE +test_list_option=--list diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..c978a52 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include AUTHORS +include ChangeLog +exclude .gitignore +exclude .gitreview + +global-exclude *.pyc diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..a1ec94f --- /dev/null +++ b/README.rst @@ -0,0 +1,4 @@ +Validations-common +================== + +A collection of common Ansible libraries and plugins for the Validation Framework diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 0000000..8e60cc8 --- /dev/null +++ b/bindep.txt @@ -0,0 +1,37 @@ +# This file facilitates OpenStack-CI package installation +# before the execution of any tests. +# +# See the following for details: +# - https://docs.openstack.org/infra/bindep/ +# - https://opendev.org/opendev/bindep/ +# +# Even if the role does not make use of this facility, it +# is better to have this file empty, otherwise OpenStack-CI +# will fall back to installing its default packages which +# will potentially be detrimental to the tests executed. + +# The gcc compiler +gcc + +# Base requirements for RPM distros +gcc-c++ [platform:rpm] +git [platform:rpm] +libffi-devel [platform:rpm] +openssl-devel [platform:rpm] +python-devel [platform:rpm !platform:rhel-8 !platform:centos-8] +python3-devel [platform:rpm !platform:rhel-7 !platform:centos-7] +PyYAML [platform:rpm !platform:rhel-8 !platform:centos-8] +python3-pyyaml [platform:rpm !platform:rhel-7 !platform:centos-7] +python3-dnf [platform:rpm !platform:rhel-7 !platform:centos-7] + +# For SELinux +libselinux-python [platform:rpm !platform:rhel-8 !platform:centos-8] +libsemanage-python [platform:redhat !platform:rhel-8 !platform:centos-8] +libselinux-python3 [platform:rpm !platform:rhel-7 !platform:centos-7] +libsemanage-python3 [platform:redhat !platform:rhel-7 !platform:centos-7] + +# Required for compressing collected log files in CI +gzip + +# Required to build language docs +gettext diff --git a/lower-constraints.txt b/lower-constraints.txt new file mode 100644 index 0000000..7dcfd83 --- /dev/null +++ b/lower-constraints.txt @@ -0,0 +1,118 @@ +alabaster==0.7.10 +ansible-lint==3.4.21 +ansible==2.4.3.0 +anyjson==0.3.3 +appdirs==1.4.3 +asn1crypto==0.24.0 +Babel==2.5.3 +bcrypt==3.1.4 +certifi==2018.1.18 +cffi==1.11.5 +chardet==3.0.4 +cliff==2.11.0 +cmd2==0.8.1 +coverage==4.0 +cryptography==2.1.4 +debtcollector==1.19.0 +decorator==4.3.0 +deprecation==2.0 +docker-pycreds==0.2.2 +docker==3.1.1 +docutils==0.14 +dogpile.cache==0.6.5 +dulwich==0.19.0 +enum-compat==0.0.2 +eventlet==0.20.0 +extras==1.0.0 +fasteners==0.14.1 +fixtures==3.0.0 +flake8==2.5.5 +gitdb2==2.0.3 +GitPython==2.1.8 +greenlet==0.4.13 +hacking==0.11.0 +idna==2.6 +imagesize==1.0.0 +iso8601==0.1.12 +Jinja2==2.10 +jmespath==0.9.3 +jsonpatch==1.21 +jsonpointer==2.0 +jsonschema==2.6.0 +keystoneauth1==3.12.0 +linecache2==1.0.0 +MarkupSafe==1.0 +mccabe==0.2.1 +mistral-lib==1.2.0 +mock==2.0.0 +monotonic==1.4 +mox3==0.25.0 +msgpack==0.5.6 +munch==2.2.0 +netaddr==0.7.18 +netifaces==0.10.6 +openstackdocstheme==1.20.0 +openstacksdk==0.24.0 +os-client-config==1.29.0 +os-net-config==7.1.0 +os-service-types==1.2.0 +osc-lib==1.14.0 +oslo.concurrency==3.26.0 +oslo.config==5.2.0 +oslo.context==2.22.0 +oslo.i18n==3.20.0 +oslo.log==3.37.0 +oslo.serialization==2.25.0 +oslo.utils==3.40.2 +oslotest==3.2.0 +packaging==17.1 +paramiko==2.4.1 +passlib==1.7.1 +pbr==3.1.1 +pep8==1.5.7 +prettytable==0.7.2 +pyasn1==0.4.2 +pycparser==2.18 +pyflakes==0.8.1 +Pygments==2.2.0 +pyinotify==0.9.6 +PyNaCl==1.2.1 +pyOpenSSL==17.5.0 +pyparsing==2.2.0 +pyperclip==1.6.0 +python-dateutil==2.7.0 +python-glanceclient==2.9.1 +python-heatclient==1.10.0 +python-ironic-inspector-client==3.1.1 +python-ironicclient==2.7.0 +python-keystoneclient==3.20.0 +python-mimeparse==1.6.0 +python-mistralclient==3.1.0 +python-novaclient==15.0.0 +python-subunit==1.0.0 +python-swiftclient==3.5.0 +python-zaqarclient==1.9.0 +pytz==2018.3 +PyYAML==3.12 +reno==2.5.0 +requests==2.18.4 +requestsexceptions==1.4.0 +rfc3986==1.1.0 +simplejson==3.13.2 +six==1.11.0 +smmap2==2.0.3 +snowballstemmer==1.2.1 +Sphinx==1.8.0 +sphinxcontrib-websupport==1.0.1 +stevedore==1.28.0 +tenacity==5.0.1 +testrepository==0.0.18 +testscenarios==0.4 +testtools==2.2.0 +traceback2==1.4.0 +tripleo-common==7.1.0 +unittest2==1.1.0 +urllib3==1.22 +warlock==1.3.0 +websocket-client==0.47.0 +wrapt==1.10.11 diff --git a/molecule-requirements.txt b/molecule-requirements.txt new file mode 100644 index 0000000..69d6b89 --- /dev/null +++ b/molecule-requirements.txt @@ -0,0 +1,11 @@ +# this is required for the molecule jobs +ansible +ansi2html +docker +pytest +pytest-cov +pytest-html +pytest-xdist +mock +molecule>=2.22rc1,<3 +selinux # MIT diff --git a/releasenotes/notes/.gitkeep b/releasenotes/notes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/releasenotes/source/_static/.gitkeep b/releasenotes/source/_static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py new file mode 100644 index 0000000..06d7167 --- /dev/null +++ b/releasenotes/source/conf.py @@ -0,0 +1,321 @@ +# -*- 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. +# +# flake8: noqa + +# 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 +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'openstackdocstheme', + 'reno.sphinxext', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The encoding of source files. +# +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +authors = u'Validations Framework Developers' +project = u'validations-common Release Notes' +copyright = u'2020, ' + authors + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +# language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# +# today = '' +# +# Else, today_fmt is used as the format for a strftime call. +# +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# +# default_role = None + +# 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 + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +# todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'openstackdocs' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. +# "<project> v<release> documentation" by default. +# +# html_title = u'validations-common v1.0' + +# A shorter title for the navigation bar. Default is the same as html_title. +# +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# +# html_logo = None + +# The name of an image file (relative to this directory) to use as a favicon of +# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# +# html_extra_path = [] + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# +# html_additional_pages = {} + +# If false, no module index is generated. +# +# html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +# +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' +# +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# 'ja' uses this config value. +# 'zh' user can custom change `jieba` dictionary path. +# +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'validations-commonReleaseNotesdoc' + +# -- Options for LaTeX output --------------------------------------------- + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'validations-commonReleaseNotes.tex', + u'validations-common Release Notes Documentation', + authors, 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# +# latex_use_parts = False + +# If true, show page references after internal links. +# +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# +# latex_appendices = [] + +# It false, will not define \strong, \code, itleref, \crossref ... but only +# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added +# packages. +# +# latex_keep_old_macro_names = True + +# If false, no module index is generated. +# +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'validations-commonreleasenotes', + u'validations-common Release Notes Documentation', + [authors], 1) +] + +# If true, show URL addresses after external links. +# +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'validations-commonReleaseNotes', + u'validations-common Release Notes Documentation', + authors, 'validations-commonReleaseNotes', + 'A collection of Ansible playbooks to detect and report potential issues during TripleO deployments.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +# +# texinfo_appendices = [] + +# If false, no module index is generated. +# +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# +# texinfo_no_detailmenu = False + +# -- Options for Internationalization output ------------------------------ +locale_dirs = ['locale/'] + +# openstackdocstheme options +repository_name = 'openstack/validations-common' +bug_project = 'tripleo' +bug_tag = 'documentation' diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst new file mode 100644 index 0000000..cbf65d1 --- /dev/null +++ b/releasenotes/source/index.rst @@ -0,0 +1,24 @@ +============================================= +Welcome to validations-common' Release Notes! +============================================= + +Contents +======== + +.. toctree:: + :maxdepth: 2 + + unreleased + train + stein + rocky + queens + pike + ocata + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` diff --git a/releasenotes/source/ocata.rst b/releasenotes/source/ocata.rst new file mode 100644 index 0000000..ebe62f4 --- /dev/null +++ b/releasenotes/source/ocata.rst @@ -0,0 +1,6 @@ +=================================== + Ocata Series Release Notes +=================================== + +.. release-notes:: + :branch: origin/stable/ocata diff --git a/releasenotes/source/pike.rst b/releasenotes/source/pike.rst new file mode 100644 index 0000000..e43bfc0 --- /dev/null +++ b/releasenotes/source/pike.rst @@ -0,0 +1,6 @@ +=================================== + Pike Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/pike diff --git a/releasenotes/source/queens.rst b/releasenotes/source/queens.rst new file mode 100644 index 0000000..36ac616 --- /dev/null +++ b/releasenotes/source/queens.rst @@ -0,0 +1,6 @@ +=================================== + Queens Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/queens diff --git a/releasenotes/source/rocky.rst b/releasenotes/source/rocky.rst new file mode 100644 index 0000000..40dd517 --- /dev/null +++ b/releasenotes/source/rocky.rst @@ -0,0 +1,6 @@ +=================================== + Rocky Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/rocky diff --git a/releasenotes/source/stein.rst b/releasenotes/source/stein.rst new file mode 100644 index 0000000..efaceb6 --- /dev/null +++ b/releasenotes/source/stein.rst @@ -0,0 +1,6 @@ +=================================== + Stein Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/stein diff --git a/releasenotes/source/train.rst b/releasenotes/source/train.rst new file mode 100644 index 0000000..5839003 --- /dev/null +++ b/releasenotes/source/train.rst @@ -0,0 +1,6 @@ +========================== +Train Series Release Notes +========================== + +.. release-notes:: + :branch: stable/train diff --git a/releasenotes/source/unreleased.rst b/releasenotes/source/unreleased.rst new file mode 100644 index 0000000..b7be79e --- /dev/null +++ b/releasenotes/source/unreleased.rst @@ -0,0 +1,5 @@ +============================== +Current Series Release Notes +============================== + +.. release-notes:: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8552d38 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,16 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +pbr>=3.1.1 # Apache-2.0 +oslo.config>=5.2.0 # Apache-2.0 +keystoneauth1>=3.12.0 # Apache-2.0 +python-novaclient>=15.1.0 # Apache-2.0 +python-heatclient>=1.10.0 # Apache-2.0 +python-glanceclient>=2.9.1 # Apache-2.0 +python-ironicclient>=2.7.0 # Apache-2.0 +python-ironic-inspector-client>=3.1.1 # Apache-2.0 +os-net-config>=7.1.0 # Apache-2.0 +oslo.utils>=3.40.2 # Apache-2.0 +six>=1.11.0 # MIT +tripleo-common>=7.1.0 # Apache-2.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..35e7810 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,50 @@ +[metadata] +name = validations-common +summary = A common Ansible libraries and plugins for the validations framework +description-file = + README.rst +author = OpenStack +author-email = openstack-discuss@lists.openstack.org +home-page = https://docs.openstack.org/tripleo-validations/latest/ +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + +[files] +packages = + validations_common + +data_files = + share/validations-common/roles = roles/* + share/validations-common/callback_plugins = callback_plugins/* + share/validations-common/lookup_plugins = lookup_plugins/* + share/validations-common/library = library/* + +[build_sphinx] +source-dir = doc/source +build-dir = doc/build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/build/html + +[compile_catalog] +directory = validations-common/locale +domain = validations-common + +[update_catalog] +domain = validations-common +output_dir = validations-common/locale +input_file = validations-common/locale/validations-common.pot + +[extract_messages] +keywords = _ gettext ngettext l_ lazy_gettext +mapping_file = babel.cfg +output_file = validations-common/locale/validations-common.pot diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..566d844 --- /dev/null +++ b/setup.py @@ -0,0 +1,29 @@ +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# 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. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass + +setuptools.setup( + setup_requires=['pbr>=2.0.0'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..1d86fba --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,18 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +openstackdocstheme>=1.20.0 # Apache-2.0 +hacking<0.12,>=0.11.0 # Apache-2.0 + +coverage!=4.4,>=4.0 # Apache-2.0 +python-subunit>=1.0.0 # Apache-2.0/BSD +sphinx>=1.8.0,<2.0.0;python_version=='2.7' # BSD +sphinx>=1.8.0,!=2.1.0;python_version>='3.4' # BSD +oslotest>=3.2.0 # Apache-2.0 +testrepository>=0.0.18 # Apache-2.0/BSD +testscenarios>=0.4 # Apache-2.0/BSD +testtools>=2.2.0 # MIT +reno>=2.5.0 # Apache-2.0 +netaddr>=0.7.18 # BSD +pre-commit # MIT diff --git a/tools/releasenotes_tox.sh b/tools/releasenotes_tox.sh new file mode 100755 index 0000000..c37cf59 --- /dev/null +++ b/tools/releasenotes_tox.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +rm -rf releasenotes/build + +sphinx-build -a -E -W \ + -d releasenotes/build/doctrees \ + -b html \ + releasenotes/source releasenotes/build/html +BUILD_RESULT=$? + +UNCOMMITTED_NOTES=$(git status --porcelain | \ + awk '$1 == "M" && $2 ~ /releasenotes\/notes/ {print $2}') + +if [ "${UNCOMMITTED_NOTES}" ]; then + cat <<EOF + +REMINDER: The following changes to release notes have not been committed: + +${UNCOMMITTED_NOTES} + +While that may be intentional, keep in mind that release notes are built from +committed changes, not the working directory. + +EOF +fi + +exit ${BUILD_RESULT} diff --git a/tools/validate-files.py b/tools/validate-files.py new file mode 100755 index 0000000..7b35e06 --- /dev/null +++ b/tools/validate-files.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python +# 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 argparse +import os +import sys + + +def exit_usage(): + print('Usage %s <directory>' % sys.argv[0]) + sys.exit(1) + + +def validate_library_file(file_path): + with open(file_path) as f: + file_content = f.read() + if 'DOCUMENTATION = ' not in file_content \ + or 'EXAMPLES = ' not in file_content: + if quiet < 1: + print('Missing ansible documentation in %s' % file_path) + return 1 + return 0 + + +def parse_args(): + p = argparse.ArgumentParser() + + p.add_argument('--quiet', '-q', + action='count', + # TODO(akrivoka): Python3 sets this default to None instead + # of 0. Remove this when this bug is fixed in Python3. + default=0, + help='output warnings and errors (-q) or only errors (-qq)') + + p.add_argument('path_args', + nargs='*', + default=['.']) + + return p.parse_args() + + +args = parse_args() +path_args = args.path_args +quiet = args.quiet +exit_val = 0 +failed_files = [] + +for base_path in path_args: + if os.path.isdir(base_path): + for subdir, dirs, files in os.walk(base_path): + if '.tox' in dirs: + dirs.remove('.tox') + if '.git' in dirs: + dirs.remove('.git') + for f in files: + if f.endswith('.py') \ + and not f == '__init__.py' \ + and subdir in [os.path.join(base_path, + 'validations', + 'library'), + os.path.join(base_path, + 'library')]: + file_path = os.path.join(subdir, f) + if quiet < 1: + print('Validating %s' % file_path) + failed = validate_library_file(file_path) + if failed: + failed_files.append(file_path) + exit_val |= failed + else: + print('Unexpected argument %s' % base_path) + exit_usage() + +if failed_files: + print('Validation failed on:') + for f in failed_files: + print(f) +else: + print('Validation successful!') +sys.exit(exit_val) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..473e92b --- /dev/null +++ b/tox.ini @@ -0,0 +1,123 @@ +[tox] +minversion = 2.0 +envlist = linters,docs,py37,molecule +skipdist = True + +[testenv] +usedevelop = True +passenv = * +setenv = + ANSIBLE_CALLBACK_PLUGINS={toxinidir}/callback_plugins + ANSIBLE_LOOKUP_PLUGINS={toxinidir}/lookup_plugins + ANSIBLE_LIBRARY={toxinidir}/library + ANSIBLE_ROLES_PATH={toxinidir}/roles + ANSIBLE_NOCOWS=1 + ANSIBLE_RETRY_FILES_ENABLED=0 + ANSIBLE_STDOUT_CALLBACK=debug + ANSIBLE_LOG_PATH={envlogdir}/ansible-execution.log + # pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207 + # paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598 + PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning + PIP_DISABLE_PIP_VERSION_CHECK=1 +commands = python setup.py test --slowest --testr-args='{posargs}' +sitepackages = True +deps = + -c {env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt + -r {toxinidir}/molecule-requirements.txt +whitelist_externals = bash + +[testenv:bindep] +# Do not install any requirements. We want this to be fast and work even if +# system dependencies are missing, since it's used to tell you what system +# dependencies are missing! This also means that bindep must be installed +# separately, outside of the requirements files. +deps = bindep +commands = bindep test + +[testenv:debug] +commands = oslo_debug_helper {posargs} + +[testenv:pep8] +envdir = {toxworkdir}/linters +commands = + python -m pre_commit run flake8 -a + +[testenv:ansible-lint] +envdir = {toxworkdir}/linters +deps = + {[testenv:linters]deps} +commands = + bash -c "ANSIBLE_ROLES_PATH='{toxinidir}/roles'" + bash -c "ANSIBLE_LIBRARY='{toxinidir}/library'" + python -m pre_commit run ansible-lint -a + +[testenv:yamllint] +envdir = {toxworkdir}/linters +deps = {[testenv:linters]deps} +commands = + python -m pre_commit run yamllint -a + +[testenv:bashate] +envdir = {toxworkdir}/linters +deps = {[testenv:linters]deps} +commands = + python -m pre_commit run bashate -a + +[testenv:whitespace] +envdir = {toxworkdir}/linters +deps = {[testenv:linters]deps} +commands = + python -m pre_commit run trailing-whitespace -a + +[testenv:shebangs] +envdir = {toxworkdir}/linters +deps = {[testenv:linters]deps} +commands = + python -m pre_commit run check-executables-have-shebangs -a + +[testenv:linters] +deps = + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt + -r {toxinidir}/molecule-requirements.txt +commands = + python '{toxinidir}/tools/validate-files.py' . + {[testenv:ansible-lint]commands} + {[testenv:yamllint]commands} + {[testenv:bashate]commands} + {[testenv:whitespace]commands} + {[testenv:shebangs]commands} + +[testenv:releasenotes] +deps = -r{toxinidir}/doc/requirements.txt +commands = + sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html + +[testenv:cover] +deps = + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt + -r {toxinidir}/molecule-requirements.txt +commands = python setup.py test --coverage --testr-args='{posargs}' + +[testenv:docs] +deps = + -r {toxinidir}/doc/requirements.txt + -r {toxinidir}/molecule-requirements.txt +commands= + sphinx-build -a -E -W -d doc/build/doctrees --keep-going -b html doc/source doc/build/html -T + doc8 doc + +[doc8] +# Settings for doc8: +extensions = .rst +ignore = D001 + +[testenv:lower-constraints] +deps = + -c{toxinidir}/lower-constraints.txt + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/requirements.txt + -r{toxinidir}/molecule-requirements.txt