oslo.upgradecheck-1.0.1/0000775000175000017500000000000013643051110015125 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/.zuul.yaml0000664000175000017500000000034713643051010017071 0ustar zuulzuul00000000000000- project: templates: - publish-openstack-docs-pti - openstack-python3-ussuri-jobs - check-requirements - release-notes-jobs-python3 - periodic-stable-jobs - openstack-lower-constraints-jobs oslo.upgradecheck-1.0.1/requirements.txt0000664000175000017500000000050313643051010020406 0ustar zuulzuul00000000000000# 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. Babel>=2.3.4 # BSD oslo.config>=5.2.0 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0 PrettyTable<0.8,>=0.7.1 # BSD oslo.upgradecheck-1.0.1/setup.py0000664000175000017500000000126213643051010016637 0ustar zuulzuul00000000000000# 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. import setuptools setuptools.setup( setup_requires=['pbr'], pbr=True) oslo.upgradecheck-1.0.1/babel.cfg0000664000175000017500000000002113643051010016643 0ustar zuulzuul00000000000000[python: **.py] oslo.upgradecheck-1.0.1/LICENSE0000664000175000017500000002363713643051010016144 0ustar zuulzuul00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. oslo.upgradecheck-1.0.1/.coveragerc0000664000175000017500000000015713643051010017250 0ustar zuulzuul00000000000000[run] branch = True source = oslo_upgradecheck omit = oslo_upgradecheck/tests/* [report] ignore_errors = True oslo.upgradecheck-1.0.1/HACKING.rst0000664000175000017500000000023413643051010016721 0ustar zuulzuul00000000000000oslo.upgradecheck Style Commandments ==================================== Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/ oslo.upgradecheck-1.0.1/PKG-INFO0000664000175000017500000000306313643051110016224 0ustar zuulzuul00000000000000Metadata-Version: 1.2 Name: oslo.upgradecheck Version: 1.0.1 Summary: Common code for writing OpenStack upgrade checks Home-page: http://launchpad.net/oslo Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: ================= oslo.upgradecheck ================= Common code for writing OpenStack upgrade checks This project contains the common code necessary for writing upgrade checks in OpenStack projects. It includes a module (oslo_upgradecheck.upgradecheck) for the common code as well as an example (oslo_upgradecheck.__main__) of integrating that code into a project. * Free software: Apache license * Documentation: https://docs.openstack.org/oslo.upgradecheck/latest/ * Source: https://opendev.org/openstack/oslo.upgradecheck * Bugs: https://bugs.launchpad.net/oslo.upgradecheck Platform: UNKNOWN Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Requires-Python: >=3.6 oslo.upgradecheck-1.0.1/releasenotes/0000775000175000017500000000000013643051110017616 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/releasenotes/source/0000775000175000017500000000000013643051110021116 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/releasenotes/source/conf.py0000664000175000017500000000203613643051010022415 0ustar zuulzuul00000000000000# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Project information ----------------------------------------------------- copyright = '2018, Oslo Contributors' author = 'Oslo Contributors' # The short X.Y version version = '' # The full version, including alpha/beta/rc tags release = '' # -- 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 = [ 'reno.sphinxext', 'openstackdocstheme', ] # The master toctree document. master_doc = 'index' # -- 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' oslo.upgradecheck-1.0.1/releasenotes/source/train.rst0000664000175000017500000000017613643051010022770 0ustar zuulzuul00000000000000========================== Train Series Release Notes ========================== .. release-notes:: :branch: stable/train oslo.upgradecheck-1.0.1/releasenotes/source/index.rst0000664000175000017500000000017713643051010022763 0ustar zuulzuul00000000000000oslo.upgradecheck Release Notes =============================== .. toctree:: :maxdepth: 1 unreleased train stein oslo.upgradecheck-1.0.1/releasenotes/source/_static/0000775000175000017500000000000013643051110022544 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/releasenotes/source/_static/.placeholder0000664000175000017500000000000013643051010025014 0ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/releasenotes/source/stein.rst0000664000175000017500000000022113643051010022764 0ustar zuulzuul00000000000000=================================== Stein Series Release Notes =================================== .. release-notes:: :branch: stable/stein oslo.upgradecheck-1.0.1/releasenotes/source/_templates/0000775000175000017500000000000013643051110023253 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/releasenotes/source/_templates/.placeholder0000664000175000017500000000000013643051010025523 0ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/releasenotes/source/unreleased.rst0000664000175000017500000000016013643051010023773 0ustar zuulzuul00000000000000============================== Current Series Release Notes ============================== .. release-notes:: oslo.upgradecheck-1.0.1/releasenotes/notes/0000775000175000017500000000000013643051110020746 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/releasenotes/notes/drop-python27-support-bd23b9c4556739ba.yaml0000664000175000017500000000017713643051010030224 0ustar zuulzuul00000000000000--- upgrade: - | Support for Python 2.7 has been dropped. The minimum version of Python now supported is Python 3.6. oslo.upgradecheck-1.0.1/releasenotes/notes/json-output-78a9e19588b7b1e1.yaml0000664000175000017500000000041513643051010026314 0ustar zuulzuul00000000000000--- features: - | oslo.upgradecheck now supports the command line flag ``--json`` to have the upgrade check results output in a compact, machine readable JSON format. The default output without this flag remains a human readable table of the results. oslo.upgradecheck-1.0.1/lower-constraints.txt0000664000175000017500000000024613643051010021364 0ustar zuulzuul00000000000000Babel==2.3.4 oslo.config==5.2.0 oslo.i18n==3.15.3 enum34==1.0.4 PrettyTable==0.7.1 oslotest==1.5.1 stestr==2.0.0 Sphinx==1.8.0 reno==2.5.0 openstackdocstheme==1.20.0 oslo.upgradecheck-1.0.1/setup.cfg0000664000175000017500000000224413643051110016750 0ustar zuulzuul00000000000000[metadata] name = oslo.upgradecheck summary = Common code for writing OpenStack upgrade checks description-file = README.rst author = OpenStack author-email = openstack-discuss@lists.openstack.org home-page = http://launchpad.net/oslo python-requires = >=3.6 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 Programming Language :: Python :: 3 :: Only Programming Language :: Python :: Implementation :: CPython [files] packages = oslo_upgradecheck [compile_catalog] directory = oslo.upgradecheck/locale domain = oslo.upgradecheck [update_catalog] domain = oslo.upgradecheck output_dir = oslo.upgradecheck/locale input_file = oslo.upgradecheck/locale/oslo.upgradecheck.pot [extract_messages] keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = oslo.upgradecheck/locale/oslo.upgradecheck.pot [egg_info] tag_build = tag_date = 0 oslo.upgradecheck-1.0.1/AUTHORS0000664000175000017500000000116613643051110016201 0ustar zuulzuul00000000000000Andreas Jaeger Ben Nemec Charles Short Chris Dent Corey Bryant Doug Hellmann Ghanshyam Mann Hervé Beraud Matt Riedemann OpenStack Release Bot Sean McGinnis Slawek Kaplonski Stephen Finucane caoyuan jacky06 pengyuesheng qingszhao oslo.upgradecheck-1.0.1/test-requirements.txt0000664000175000017500000000042213643051010021363 0ustar zuulzuul00000000000000# 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. hacking>=3.0,<3.1.0 # Apache-2.0 oslotest>=1.5.1 stestr>=2.0.0 oslo.upgradecheck-1.0.1/.stestr.conf0000664000175000017500000000006313643051010017374 0ustar zuulzuul00000000000000[DEFAULT] test_path=./oslo_upgradecheck top_dir=./ oslo.upgradecheck-1.0.1/README.rst0000664000175000017500000000110713643051010016612 0ustar zuulzuul00000000000000================= oslo.upgradecheck ================= Common code for writing OpenStack upgrade checks This project contains the common code necessary for writing upgrade checks in OpenStack projects. It includes a module (oslo_upgradecheck.upgradecheck) for the common code as well as an example (oslo_upgradecheck.__main__) of integrating that code into a project. * Free software: Apache license * Documentation: https://docs.openstack.org/oslo.upgradecheck/latest/ * Source: https://opendev.org/openstack/oslo.upgradecheck * Bugs: https://bugs.launchpad.net/oslo.upgradecheck oslo.upgradecheck-1.0.1/ChangeLog0000664000175000017500000000411613643051110016701 0ustar zuulzuul00000000000000CHANGES ======= 1.0.1 ----- * Update hacking for Python3 * Use unittest.mock instead of third party mock 1.0.0 ----- * remove outdated header * [ussuri][goal] Drop python 2.7 support and testing 0.4.0 ----- * tox: Trivial cleanup * Bump Babel to 2.3.4 on lower-constraint * tox: Keeping going with docs * Switch to Ussuri jobs * Bump the openstackdocstheme extension to 1.20 * Update the constraints url * Update master for stable/train 0.3.2 ----- 0.3.1 ----- * Add Python 3 Train unit tests * Move doc related modules to doc/requirements.txt 0.3.0 ----- * Address nits from json change * Enable JSON results output * Sync Sphinx requirement * Replace git.openstack.org URLs with opendev.org URLs * OpenDev Migration Patch * Dropping the py35 testing * Update master for stable/stein 0.2.1 ----- 0.2.0 ----- * Change python3.5 job to python3.7 job on Stein+ * Add doc params to run and register\_cli\_opts * Move displayed checker title to be in variable * Separate opt registration from command running * Update py33,py34 to py35,py36 * doc: Switch to openstackdocstheme * doc: Remove crud from conf.py file * Change openstack-dev to openstack-discuss 0.1.1 ----- * Force translation of table header 0.1.0 ----- * Use template for lower-constraints zuul job * Move example implementation to docs * Add reno support * Don't run tempest jobs on changes * Add database access details to UpgradeCommands docstring * enable debug output for tests * tighten API for main() * Improve config handling * Modernize tox.ini * Use sphinx-build for all docs venvs * Add lower-constraints job * Shorten UpgradeCheck class names * Add proper documentation * Use python3 by default * Flesh out readme * Add .zuul.yaml and .stestr.conf * Flesh out readme * Add success test case * Handle exceptions from checks * Propagate return code * Add more unit tests * Test \_get\_details * Get coverage job working * Remove history file from docs * Migrate to stestr * Add docstring to main() * Fix pep8 failures * Proper requirements specification * Add \_i18n module * Add i18n support * Initial implementation * Initial commit oslo.upgradecheck-1.0.1/tox.ini0000664000175000017500000000317513643051010016445 0ustar zuulzuul00000000000000[tox] minversion = 3.1.1 envlist = py37,pep8 skipsdist = True ignore_basepython_conflict = true [testenv] basepython = python3 usedevelop = True setenv = VIRTUAL_ENV={envdir} OS_DEBUG=1 OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt commands = stestr run --slowest {posargs} [testenv:pep8] commands = flake8 {posargs} [testenv:venv] commands = {posargs} [testenv:cover] deps = {[testenv]deps} coverage setenv = PYTHON=coverage run --source oslo_upgradecheck --parallel-mode commands = stestr run '{posargs}' coverage combine coverage html -d cover coverage xml -o cover/coverage.xml [testenv:docs] whitelist_externals = rm deps = {[testenv]deps} -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/build sphinx-build -W --keep-going -b html doc/source doc/build/html [testenv:debug] commands = oslo_debug_helper {posargs} [testenv:lower-constraints] deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt [testenv:releasenotes] deps = {[testenv:docs]deps} whitelist_externals = rm commands = rm -rf releasenotes/build sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html [flake8] # E123, E125 skipped as they are invalid PEP-8. show-source = True ignore = E123,E125,W504 builtins = _ exclude=.venv,.git,.tox,dist,doc,releasenotes,*lib/python*,*egg,build [hacking] import_exception = oslo_upgradecheck._i18n oslo.upgradecheck-1.0.1/oslo.upgradecheck.egg-info/0000775000175000017500000000000013643051110022217 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/oslo.upgradecheck.egg-info/top_level.txt0000664000175000017500000000002213643051110024743 0ustar zuulzuul00000000000000oslo_upgradecheck oslo.upgradecheck-1.0.1/oslo.upgradecheck.egg-info/SOURCES.txt0000664000175000017500000000224613643051110024107 0ustar zuulzuul00000000000000.coveragerc .mailmap .stestr.conf .zuul.yaml AUTHORS CONTRIBUTING.rst ChangeLog HACKING.rst LICENSE README.rst babel.cfg lower-constraints.txt requirements.txt setup.cfg setup.py test-requirements.txt tox.ini doc/requirements.txt doc/source/api.rst doc/source/conf.py doc/source/contributing.rst doc/source/index.rst doc/source/installation.rst doc/source/main.py doc/source/usage.rst oslo.upgradecheck.egg-info/PKG-INFO oslo.upgradecheck.egg-info/SOURCES.txt oslo.upgradecheck.egg-info/dependency_links.txt oslo.upgradecheck.egg-info/not-zip-safe oslo.upgradecheck.egg-info/pbr.json oslo.upgradecheck.egg-info/requires.txt oslo.upgradecheck.egg-info/top_level.txt oslo_upgradecheck/__init__.py oslo_upgradecheck/_i18n.py oslo_upgradecheck/upgradecheck.py oslo_upgradecheck/tests/__init__.py oslo_upgradecheck/tests/test_upgradecheck.py releasenotes/notes/drop-python27-support-bd23b9c4556739ba.yaml releasenotes/notes/json-output-78a9e19588b7b1e1.yaml releasenotes/source/conf.py releasenotes/source/index.rst releasenotes/source/stein.rst releasenotes/source/train.rst releasenotes/source/unreleased.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholderoslo.upgradecheck-1.0.1/oslo.upgradecheck.egg-info/not-zip-safe0000664000175000017500000000000113643051110024445 0ustar zuulzuul00000000000000 oslo.upgradecheck-1.0.1/oslo.upgradecheck.egg-info/PKG-INFO0000664000175000017500000000306313643051110023316 0ustar zuulzuul00000000000000Metadata-Version: 1.2 Name: oslo.upgradecheck Version: 1.0.1 Summary: Common code for writing OpenStack upgrade checks Home-page: http://launchpad.net/oslo Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: ================= oslo.upgradecheck ================= Common code for writing OpenStack upgrade checks This project contains the common code necessary for writing upgrade checks in OpenStack projects. It includes a module (oslo_upgradecheck.upgradecheck) for the common code as well as an example (oslo_upgradecheck.__main__) of integrating that code into a project. * Free software: Apache license * Documentation: https://docs.openstack.org/oslo.upgradecheck/latest/ * Source: https://opendev.org/openstack/oslo.upgradecheck * Bugs: https://bugs.launchpad.net/oslo.upgradecheck Platform: UNKNOWN Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Requires-Python: >=3.6 oslo.upgradecheck-1.0.1/oslo.upgradecheck.egg-info/dependency_links.txt0000664000175000017500000000000113643051110026265 0ustar zuulzuul00000000000000 oslo.upgradecheck-1.0.1/oslo.upgradecheck.egg-info/requires.txt0000664000175000017500000000011213643051110024611 0ustar zuulzuul00000000000000Babel>=2.3.4 oslo.config>=5.2.0 oslo.i18n>=3.15.3 PrettyTable<0.8,>=0.7.1 oslo.upgradecheck-1.0.1/oslo.upgradecheck.egg-info/pbr.json0000664000175000017500000000005613643051110023676 0ustar zuulzuul00000000000000{"git_version": "b93610d", "is_release": true}oslo.upgradecheck-1.0.1/.mailmap0000664000175000017500000000013113643051010016540 0ustar zuulzuul00000000000000# Format is: # # oslo.upgradecheck-1.0.1/oslo_upgradecheck/0000775000175000017500000000000013643051110020606 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/oslo_upgradecheck/_i18n.py0000664000175000017500000000211113643051010022070 0ustar zuulzuul00000000000000# Copyright 2018 Red Hat Inc. # # 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 oslo_i18n DOMAIN = "oslo_upgradecheck" _translators = oslo_i18n.TranslatorFactory(domain=DOMAIN) # The primary translation function using the well-known name "_" _ = _translators.primary # The contextual translation function using the name "_C" # requires oslo.i18n >=2.1.0 _C = _translators.contextual_form # The plural translation function using the name "_P" # requires oslo.i18n >=2.1.0 _P = _translators.plural_form def get_available_languages(): return oslo_i18n.get_available_languages(DOMAIN) oslo.upgradecheck-1.0.1/oslo_upgradecheck/tests/0000775000175000017500000000000013643051110021750 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/oslo_upgradecheck/tests/test_upgradecheck.py0000664000175000017500000000655313643051010026016 0ustar zuulzuul00000000000000# -*- 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_upgradecheck ---------------------------------- Tests for `upgradecheck` module. """ import os.path import subprocess import sys from unittest import mock from oslo_config import cfg from oslotest import base from oslo_upgradecheck import upgradecheck class TestUpgradeCheckResult(base.BaseTestCase): def test_details(self): result = upgradecheck.Result(upgradecheck.Code.SUCCESS, 'test details') self.assertEqual(0, result.code) self.assertEqual('test details', result.details) class TestCommands(upgradecheck.UpgradeCommands): def success(self): return upgradecheck.Result(upgradecheck.Code.SUCCESS, 'Always succeeds') def warning(self): return upgradecheck.Result(upgradecheck.Code.WARNING, 'Always warns') def failure(self): return upgradecheck.Result(upgradecheck.Code.FAILURE, 'Always fails') _upgrade_checks = (('always succeeds', success), ('always warns', warning), ('always fails', failure), ) class SuccessCommands(TestCommands): _upgrade_checks = () class TestUpgradeCommands(base.BaseTestCase): def test_get_details(self): result = upgradecheck.Result(upgradecheck.Code.SUCCESS, '*' * 70) upgrade_commands = upgradecheck.UpgradeCommands() details = upgrade_commands._get_details(result) wrapped = '*' * 60 + '\n ' + '*' * 10 self.assertEqual(wrapped, details) def test_check(self): inst = TestCommands() result = inst.check() self.assertEqual(upgradecheck.Code.FAILURE, result) class TestMain(base.BaseTestCase): def _run_test(self, upgrade_command, expected): conf = cfg.ConfigOpts() result = upgradecheck.main( conf=conf, project='oslo-upgradecheck-test', upgrade_command=upgrade_command, argv=['upgrade', 'check'], ) self.assertEqual(expected, result) def test_main(self): inst = TestCommands() self._run_test(inst, upgradecheck.Code.FAILURE) def test_main_exception(self): raises = mock.Mock() raises.check.side_effect = Exception('test exception') self._run_test(raises, 255) def test_main_success(self): inst = SuccessCommands() self._run_test(inst, 0) class TestExampleFile(base.BaseTestCase): def test_example_main(self): path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../doc/source/main.py') # The example includes both a passing and failing test, which means the # overall result is failure. self.assertEqual( upgradecheck.Code.FAILURE, subprocess.call([sys.executable, path, 'upgrade', 'check'])) oslo.upgradecheck-1.0.1/oslo_upgradecheck/tests/__init__.py0000664000175000017500000000000013643051010024046 0ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/oslo_upgradecheck/__init__.py0000664000175000017500000000000013643051010022704 0ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/oslo_upgradecheck/upgradecheck.py0000664000175000017500000002070013643051010023603 0ustar zuulzuul00000000000000# Copyright 2018 Red Hat Inc. # Copyright 2016 IBM Corp. # # 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 json import sys import textwrap import traceback import enum from oslo_config import cfg import prettytable import six from oslo_upgradecheck._i18n import _ CONF = None class Code(enum.IntEnum): """Status codes for the upgrade check command""" # All upgrade readiness checks passed successfully and there is # nothing to do. SUCCESS = 0 # At least one check encountered an issue and requires further # investigation. This is considered a warning but the upgrade may be OK. WARNING = 1 # There was an upgrade status check failure that needs to be # investigated. This should be considered something that stops an upgrade. FAILURE = 2 UPGRADE_CHECK_MSG_MAP = { Code.SUCCESS: _('Success'), Code.WARNING: _('Warning'), Code.FAILURE: _('Failure'), } class Result(object): """Class used for 'nova-status upgrade check' results. The 'code' attribute is a Code enum. The 'details' attribute is a translated message generally only used for checks that result in a warning or failure code. The details should provide information on what issue was discovered along with any remediation. """ def __init__(self, code, details=None): super(Result, self).__init__() self.code = code self.details = details class UpgradeCommands(object): """Base class for upgrade checks This class should be inherited by a class in each project that provides the actual checks. Those checks should be added to the _upgrade_checks class member so that they are run when the ``check`` method is called. The subcommands here must not rely on the service object model since they should be able to run on n-1 data. Any queries to the database should be done through the sqlalchemy query language directly like the database schema migrations. """ display_title = _('Upgrade Check Results') _upgrade_checks = () def _get_details(self, upgrade_check_result): if upgrade_check_result.details is not None: # wrap the text on the details to 60 characters return '\n'.join(textwrap.wrap(upgrade_check_result.details, 60, subsequent_indent=' ')) def check(self): """Performs checks to see if the deployment is ready for upgrade. These checks are expected to be run BEFORE services are restarted with new code. :returns: Code """ return_code = Code.SUCCESS # This is a list if 2-item tuples for the check name and it's results. check_results = [] for name, func in self._upgrade_checks: result = func(self) # store the result of the check for the summary table check_results.append((name, result)) # we want to end up with the highest level code of all checks if result.code > return_code: return_code = result.code # We're going to build a summary table that looks like: # +----------------------------------------------------+ # | Upgrade Check Results | # +----------------------------------------------------+ # | Check: Cells v2 | # | Result: Success | # | Details: None | # +----------------------------------------------------+ # | Check: Placement API | # | Result: Failure | # | Details: There is no placement-api endpoint in the | # | service catalog. | # +----------------------------------------------------+ # Since registering opts can be overridden by consuming code, we can't # assume that our locally defined option exists. if (hasattr(CONF, 'command') and hasattr(CONF.command, 'json') and CONF.command.json): # NOTE(bnemec): We use six.text_type on the translated string to # force immediate translation if lazy translation is in use. # See lp1801761 for details. output = {'name': six.text_type(self.display_title), 'checks': []} for name, result in check_results: output['checks'].append( {'check': name, 'result': result.code, 'details': result.details} ) print(json.dumps(output)) else: # NOTE(bnemec): We use six.text_type on the translated string to # force immediate translation if lazy translation is in use. # See lp1801761 for details. t = prettytable.PrettyTable([six.text_type(self.display_title)], hrules=prettytable.ALL) t.align = 'l' for name, result in check_results: cell = ( _('Check: %(name)s\n' 'Result: %(result)s\n' 'Details: %(details)s') % { 'name': name, 'result': UPGRADE_CHECK_MSG_MAP[result.code], 'details': self._get_details(result), } ) t.add_row([cell]) print(t) return return_code def register_cli_options(conf, upgrade_command): """Set up the command line options. Adds a subcommand to support 'upgrade check' on the command line. :param conf: An oslo.confg ConfigOpts instance on which to register the upgrade check arguments. :param upgrade_command: The UpgradeCommands instance. """ def add_parsers(subparsers): upgrade_action = subparsers.add_parser('upgrade') upgrade_action.add_argument('check') upgrade_action.set_defaults(action_fn=upgrade_command.check) upgrade_action.add_argument( '--json', action='store_true', help='Output the results in JSON format. Default is to print ' 'results in human readable table format.') opt = cfg.SubCommandOpt('command', handler=add_parsers) conf.register_cli_opt(opt) def run(conf): """Run the requested command. :param conf: An oslo.confg ConfigOpts instance on which the upgrade commands have been previously registered. """ try: return conf.command.action_fn() except Exception: print(_('Error:\n%s') % traceback.format_exc()) # This is 255 so it's not confused with the upgrade check exit codes. return 255 def main(conf, project, upgrade_command, argv=sys.argv[1:], default_config_files=None): """Simple implementation of main for upgrade checks This can be used in upgrade check commands to provide the minimum necessary parameter handling and logic. :param conf: An oslo.confg ConfigOpts instance on which to register the upgrade check arguments. :param project: The name of the project, to be used as an argument to the oslo_config.ConfigOpts instance to find configuration files. :param upgrade_command: The UpgradeCommands instance. :param argv: The command line arguments to parse. Defaults to sys.argv[1:]. :param default_config_files: The configuration files to load. For projects that use non-standard default locations for the configuration files, use this to override the search behavior in oslo.config. """ global CONF register_cli_options(conf, upgrade_command) conf( args=argv, project=project, default_config_files=default_config_files, ) CONF = conf return run(conf) oslo.upgradecheck-1.0.1/CONTRIBUTING.rst0000664000175000017500000000122513643051010017565 0ustar zuulzuul00000000000000If you would like to contribute to the development of OpenStack, you must follow the steps in this page: http://docs.openstack.org/infra/manual/developers.html If you already have a good understanding of how the system works and your OpenStack accounts are set up, you can skip to the development workflow section of this documentation to learn how changes to OpenStack should be submitted for review via the Gerrit tool: http://docs.openstack.org/infra/manual/developers.html#development-workflow Pull requests submitted through GitHub will be ignored. Bugs should be filed on Launchpad, not GitHub: https://bugs.launchpad.net/oslo.upgradecheck oslo.upgradecheck-1.0.1/doc/0000775000175000017500000000000013643051110015672 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/doc/requirements.txt0000664000175000017500000000042613643051010021157 0ustar zuulzuul00000000000000# 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. sphinx>=1.8.0,!=2.1.0 # BSD reno>=2.5.0 openstackdocstheme>=1.20.0 oslo.upgradecheck-1.0.1/doc/source/0000775000175000017500000000000013643051110017172 5ustar zuulzuul00000000000000oslo.upgradecheck-1.0.1/doc/source/conf.py0000775000175000017500000000246213643051010020477 0ustar zuulzuul00000000000000# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config import os import sys sys.path.insert(0, os.path.abspath('../..')) # -- Project information ----------------------------------------------------- # General information about the project. copyright = '2018, Oslo Contributors' # -- 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', 'openstackdocstheme' ] # The master toctree document. master_doc = 'index' # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # -- 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 = 'openstackdocs' # -- Options for openstackdocstheme ------------------------------------------- repository_name = 'openstack/oslo.upgradecheck' bug_project = 'oslo.upgradecheck' bug_tag = '' oslo.upgradecheck-1.0.1/doc/source/index.rst0000664000175000017500000000127713643051010021041 0ustar zuulzuul00000000000000================= oslo.upgradecheck ================= Common code for writing OpenStack upgrade checks. This project can be used to assist with the implementation of a ``$SERVICE-status`` command that responds to parameters of ``upgrade check`` by running upgrade check functions on the existing installation. For further details see :doc:`usage` and the `Nova documentation on upgrade checks`_. .. _`Nova documentation on upgrade checks`: https://docs.openstack.org/nova/latest/reference/upgrade-checks.html Contents ======== .. toctree:: :maxdepth: 2 installation api usage contributing Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` oslo.upgradecheck-1.0.1/doc/source/api.rst0000664000175000017500000000016713643051010020500 0ustar zuulzuul00000000000000===== API ===== upgradecheck module ------------------- .. automodule:: oslo_upgradecheck.upgradecheck :members: oslo.upgradecheck-1.0.1/doc/source/installation.rst0000664000175000017500000000015013643051010022420 0ustar zuulzuul00000000000000============== Installation ============== At the command line:: $ pip install oslo.upgradecheck oslo.upgradecheck-1.0.1/doc/source/usage.rst0000664000175000017500000000413213643051010021027 0ustar zuulzuul00000000000000======= Usage ======= See the module ``oslo_upgradecheck.__main__`` for an example of how to use this project. Each consuming project should create a class that inherits from :class:`oslo_upgradecheck.upgradecheck.UpgradeCommands` and implement check methods on it. Those check methods should then be added to the ``_upgrade_checks`` tuple so they will be run when the :meth:`oslo_upgradecheck.upgradecheck.UpgradeCommands.check` method is called. For example:: from oslo_upgradecheck import upgradecheck class ProjectSpecificUpgradeCommands(upgradecheck.UpgradeCommands): def an_upgrade_check(self): if everything_is_awesome(): return upgradecheck.Result( upgradecheck.Code.SUCCESS, 'Success details') else: return upgradecheck.Result( upgradecheck.Code.FAILURE, 'Failure details') _upgrade_checks = (('Awesome upgrade check', an_upgrade_check)) oslo.upgradecheck also includes a basic implementation of command line argument handling that can be used to provide the minimum processing needed to implement a ``$SERVICE-status upgrade check`` command. To make use of it, write a method that creates an instance of the class created above, then pass that class's ``check`` function into :func:`oslo_upgradecheck.upgradecheck.main`. The project's ConfigOpts instance must also be passed. In most projects this will just be cfg.CONF. For example:: from oslo_config import cfg def main(): return upgradecheck.main( conf=cfg.CONF, project='myprojectname', upgrade_command=ProjectSpecificUpgradeCommands(), ) The entry point for the ``$SERVICE-status`` command should then point at this function. Alternatively, if a project has its own CLI code that it would prefer to reuse, it simply needs to ensure that the ``inst.check`` method is called when the ``upgrade check`` parameters are passed to the ``$SERVICE-status`` command. Example ------- The following is a fully functional example of implementing a check command: .. literalinclude:: main.py oslo.upgradecheck-1.0.1/doc/source/contributing.rst0000664000175000017500000000012113643051010022424 0ustar zuulzuul00000000000000============== Contributing ============== .. include:: ../../CONTRIBUTING.rst oslo.upgradecheck-1.0.1/doc/source/main.py0000664000175000017500000000245113643051010020471 0ustar zuulzuul00000000000000# Copyright 2018 Red Hat Inc. # # 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. """Example CLI command for running upgrade checks""" import sys from oslo_config import cfg from oslo_upgradecheck import upgradecheck class Checks(upgradecheck.UpgradeCommands): def success(self): return upgradecheck.Result(upgradecheck.Code.SUCCESS, 'Always succeeds') def failure(self): return upgradecheck.Result(upgradecheck.Code.FAILURE, 'Always fails') _upgrade_checks = (('always succeeds', success), ('always fails', failure), ) def main(): return upgradecheck.main( conf=cfg.CONF, project='myprojectname', upgrade_command=Checks(), ) if __name__ == '__main__': sys.exit(main())