diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e9ef4d8..0000000 --- a/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -build/ -.local/ -.testrepository/ -.tox/ -func-results.json -test-charm/ -.project -.pydevproject -**/__pycache__ diff --git a/.stestr.conf b/.stestr.conf deleted file mode 100644 index 5fcccac..0000000 --- a/.stestr.conf +++ /dev/null @@ -1,3 +0,0 @@ -[DEFAULT] -test_path=./unit_tests -top_dir=./ diff --git a/.zuul.yaml b/.zuul.yaml index 7ffc71c..e7c200a 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,4 +1,3 @@ - project: templates: - - openstack-python3-charm-yoga-jobs - - openstack-cover-jobs + - noop-jobs diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 7a4a3ea..0000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - 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. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index a67d42e..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -> **WARNING**: DO NOT USE OR CONTRIBUTE. This charm is not maintained anymore -> because the [upstream project](https://opendev.org/openstack/panko) isn't -> either. diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..2958b64 --- /dev/null +++ b/README.rst @@ -0,0 +1,10 @@ +This project is no longer maintained. + +The contents of this repository are still available in the Git +source code management system. To see the contents of this +repository before it reached its end of life, please check out the +previous commit with "git checkout HEAD^1". + +For any further questions, please email +openstack-discuss@lists.openstack.org or join #openstack-charms on +OFTC. diff --git a/pip.sh b/pip.sh deleted file mode 100755 index 9a7e6b0..0000000 --- a/pip.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -# -# This file is managed centrally by release-tools and should not be modified -# within individual charm repos. See the 'global' dir contents for available -# choices of tox.ini for OpenStack Charms: -# https://github.com/openstack-charmers/release-tools -# -# setuptools 58.0 dropped the support for use_2to3=true which is needed to -# install blessings (an indirect dependency of charm-tools). -# -# More details on the beahvior of tox and virtualenv creation can be found at -# https://github.com/tox-dev/tox/issues/448 -# -# This script is wrapper to force the use of the pinned versions early in the -# process when the virtualenv was created and upgraded before installing the -# depedencies declared in the target. -pip install 'pip<20.3' 'setuptools<50.0.0' -pip "$@" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index b786b42..0000000 --- a/requirements.txt +++ /dev/null @@ -1,22 +0,0 @@ -# This file is managed centrally by release-tools and should not be modified -# within individual charm repos. See the 'global' dir contents for available -# choices of *requirements.txt files for OpenStack Charms: -# https://github.com/openstack-charmers/release-tools -# -# NOTE(lourot): This might look like a duplication of test-requirements.txt but -# some tox targets use only test-requirements.txt whereas charm-build uses only -# requirements.txt -setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85 - -# Build requirements -charm-tools==2.8.3 - -simplejson - -# Newer versions use keywords that didn't exist in python 3.5 yet (e.g. -# "ModuleNotFoundError") -# NOTE(lourot): This might look like a duplication of test-requirements.txt but -# some tox targets use only test-requirements.txt whereas charm-build uses only -# requirements.txt -importlib-metadata<3.0.0; python_version < '3.6' -importlib-resources<3.0.0; python_version < '3.6' diff --git a/src/README.md b/src/README.md deleted file mode 100644 index a706de9..0000000 --- a/src/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Overview - -> **WARNING**: DO NOT USE OR CONTRIBUTE. This charm is not maintained anymore -> because the [upstream project](https://opendev.org/openstack/panko) isn't -> either. - -This charm provides the Panko event storage and API service for an OpenStack Cloud. - -# Usage - -Panko relies on services provided by keystone and a sqlalchemy-compatible database: - - juju deploy panko - juju deploy keystone - juju deploy percona-cluster - juju add-relation panko percona-cluster - juju add-relation panko keystone - -# Bugs - -Please report bugs on [Launchpad](https://bugs.launchpad.net/charm-panko/+filebug). - -For general questions please refer to the OpenStack [Charm Guide](http://docs.openstack.org/developer/charm-guide/). diff --git a/src/copyright b/src/copyright deleted file mode 100644 index 6f8a25f..0000000 --- a/src/copyright +++ /dev/null @@ -1,16 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0 - -Files: * -Copyright: 2015, Canonical Ltd. -License: Apache-2.0 - 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. \ No newline at end of file diff --git a/src/icon.svg b/src/icon.svg deleted file mode 100644 index c90ecfc..0000000 --- a/src/icon.svg +++ /dev/null @@ -1,450 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/layer.yaml b/src/layer.yaml deleted file mode 100644 index 6369898..0000000 --- a/src/layer.yaml +++ /dev/null @@ -1,5 +0,0 @@ -includes: ['layer:openstack-api', 'interface:panko'] -repo: 'https://github.com/openstack/charm-panko' -options: - basic: - use_venv: True diff --git a/src/lib/charm/openstack/__init__.py b/src/lib/charm/openstack/__init__.py deleted file mode 100644 index ed19ad4..0000000 --- a/src/lib/charm/openstack/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2017 Canonical Ltd -# -# 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. diff --git a/src/lib/charm/openstack/panko.py b/src/lib/charm/openstack/panko.py deleted file mode 100644 index d673c0a..0000000 --- a/src/lib/charm/openstack/panko.py +++ /dev/null @@ -1,133 +0,0 @@ -# Copyright 2017 Canonical Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os -import collections -import subprocess - -import charmhelpers.core.hookenv as hookenv -import charmhelpers.core.host as host - -import charms_openstack.charm -import charms_openstack.adapters as adapters -import charms_openstack.ip as os_ip - - -PANKO_DIR = '/etc/panko' -PANKO_CONF = os.path.join(PANKO_DIR, 'panko.conf') -PANKO_APACHE_SITE = 'panko-api' -PANKO_WSGI_CONF = '/etc/apache2/sites-available/{}.conf'.format( - PANKO_APACHE_SITE) - - -charms_openstack.charm.use_defaults('charm.default-select-release') - - -class PankoCharmRelationAdapters(adapters.OpenStackAPIRelationAdapters): - relation_adapters = { - 'shared_db': adapters.DatabaseRelationAdapter, - 'cluster': adapters.PeerHARelationAdapter, - } - - -class PankoCharm(charms_openstack.charm.HAOpenStackCharm): - - """ - Charm for Juju deployment of Panko - """ - - # Internal name of charm - service_name = name = 'panko' - - # First release supported - release = 'ocata' - - # List of packages to install for this charm - packages = ['panko-api', 'python-apt', 'python-keystonemiddleware', - 'apache2', 'python-pymysql', 'libapache2-mod-wsgi'] - - api_ports = { - 'panko-api': { - os_ip.PUBLIC: 8777, - os_ip.ADMIN: 8777, - os_ip.INTERNAL: 8777, - } - } - - default_service = 'panko-api' - - service_type = 'panko' - - services = ['apache2'] - - required_relations = ['shared-db', 'identity-service'] - - restart_map = { - PANKO_CONF: services, - PANKO_WSGI_CONF: ['apache2'], - } - - ha_resources = ['vips', 'haproxy'] - - release_pkg = 'panko-common' - - package_codenames = { - 'panko-common': collections.OrderedDict([ - ('2', 'mitaka'), - ('3', 'newton'), - ('4', 'ocata'), - ('5', 'pike'), - ('6', 'queens'), - ('7', 'rocky'), - ]), - } - - sync_cmd = ['panko-dbsync', - '--log-file=/var/log/panko/panko-upgrade.log'] - - adapters_class = PankoCharmRelationAdapters - - def install(self): - super(PankoCharm, self).install() - # NOTE(jamespage): always pause panko-api service as we force - # execution with Apache2+mod_wsgi - host.service_pause('panko-api') - - def enable_apache2_site(self): - """Enable Panko API apache2 site if rendered or installed""" - if os.path.exists(PANKO_WSGI_CONF): - check_enabled = subprocess.call( - ['a2query', '-s', PANKO_APACHE_SITE] - ) - if check_enabled != 0: - subprocess.check_call(['a2ensite', - PANKO_APACHE_SITE]) - host.service_reload('apache2', - restart_on_failure=True) - - def get_database_setup(self): - return [{ - 'database': 'panko', - 'username': 'panko', - 'hostname': hookenv.unit_private_ip()}, ] - - def disable_services(self): - '''Disable all services related to panko''' - for svc in self.services: - host.service_pause(svc) - - def enable_services(self): - '''Enable all services related to panko''' - for svc in self.services: - host.service_resume(svc) diff --git a/src/metadata.yaml b/src/metadata.yaml deleted file mode 100644 index 1083891..0000000 --- a/src/metadata.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: panko -maintainer: OpenStack Charmers -summary: Event storage and API service for OpenStack -description: | - The Panko project is an event storage service that provides - an ability to store and query event data generated by - Ceilometer and potentially other sources. -tags: - - openstack -series: - - xenial - - yakkety - - zesty - - bionic -provides: - event-service: - interface: panko diff --git a/src/reactive/panko_handlers.py b/src/reactive/panko_handlers.py deleted file mode 100644 index 27ec250..0000000 --- a/src/reactive/panko_handlers.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2017 Canonical Ltd -# -# 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 charms_openstack.charm as charm -import charms.reactive as reactive - -import charm.openstack.panko as panko # noqa - - -charm.use_defaults( - 'charm.installed', - 'shared-db.connected', - 'identity-service.connected', - 'identity-service.available', # enables SSL support - 'config.changed', - 'update-status') - - -@reactive.when_not('config.rendered') -def disable_services(): - with charm.provide_charm_instance() as charm_class: - charm_class.disable_services() - - -@reactive.when('shared-db.available') -@reactive.when('identity-service.available') -def render_config(*args): - """Render the configuration for charm when all the interfaces are - available. - """ - with charm.provide_charm_instance() as charm_class: - charm_class.render_with_interfaces(args) - charm_class.enable_apache2_site() - charm_class.enable_services() - charm_class.assess_status() - reactive.set_state('config.rendered') - - -# db_sync checks if sync has been done so rerunning is a noop -@reactive.when('config.rendered') -def init_db(): - with charm.provide_charm_instance() as charm_class: - charm_class.db_sync() - - -@reactive.when('ha.connected') -def cluster_connected(hacluster): - """Configure HA resources in corosync""" - with charm.provide_charm_instance() as charm_class: - charm_class.configure_ha_resources(hacluster) - charm_class.assess_status() - - -@reactive.when('event-service.connected') -@reactive.when('config.rendered') -def provide_panko_url(event_service): - with charm.provide_charm_instance() as charm_class: - event_service.set_panko_url(charm_class.public_url) diff --git a/src/templates/ocata/panko-api.conf b/src/templates/ocata/panko-api.conf deleted file mode 100644 index 328f022..0000000 --- a/src/templates/ocata/panko-api.conf +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################### -# [ WARNING ] -# configuration file maintained by Juju -# local changes will be overwritten. -############################################################################### - -Listen {{ options.service_listen_info.panko_api.public_port }} - - - WSGIDaemonProcess panko-api processes={{ options.wsgi_worker_context.processes }} threads=10 user=panko display-name=%{GROUP} - WSGIProcessGroup panko-api - WSGIScriptAlias / /usr/lib/python2.7/dist-packages/panko/api/app.wsgi - WSGIApplicationGroup %{GLOBAL} - - Require all granted - - ErrorLog /var/log/apache2/panko_error.log - CustomLog /var/log/apache2/panko_access.log combined - diff --git a/src/templates/panko-api.conf b/src/templates/panko-api.conf deleted file mode 100644 index 328f022..0000000 --- a/src/templates/panko-api.conf +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################### -# [ WARNING ] -# configuration file maintained by Juju -# local changes will be overwritten. -############################################################################### - -Listen {{ options.service_listen_info.panko_api.public_port }} - - - WSGIDaemonProcess panko-api processes={{ options.wsgi_worker_context.processes }} threads=10 user=panko display-name=%{GROUP} - WSGIProcessGroup panko-api - WSGIScriptAlias / /usr/lib/python2.7/dist-packages/panko/api/app.wsgi - WSGIApplicationGroup %{GLOBAL} - - Require all granted - - ErrorLog /var/log/apache2/panko_error.log - CustomLog /var/log/apache2/panko_access.log combined - diff --git a/src/templates/panko.conf b/src/templates/panko.conf deleted file mode 100644 index 64f26ca..0000000 --- a/src/templates/panko.conf +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# [ WARNING ] -# configuration file maintained by Juju -# local changes will be overwritten. -############################################################################### -[DEFAULT] -debug = {{ options.debug }} -use_syslog = {{ options.use_syslog }} -# NOTE(jamespage): Set sensible log file location for WSGI processes, -# other daemons will override using CLI options. -log_file = /var/log/panko/panko-api.log - -[api] -auth_mode = keystone - -{% if shared_db.uri -%} -[database] -connection = mysql+pymysql://{{ shared_db.username }}:{{ shared_db.password }}@{{ shared_db.host }}/{{ shared_db.database }}?charset=utf8{% if database_ssl_ca %}&ssl_ca={{ database_ssl_ca }}{% if database_ssl_cert %}&ssl_cert={{ database_ssl_cert }}&ssl_key={{ database_ssl_key }}{% endif %}{% endif %} -{%- endif %} - -{% include "parts/section-keystone-authtoken" %} diff --git a/src/test-requirements.txt b/src/test-requirements.txt deleted file mode 100644 index e771023..0000000 --- a/src/test-requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -# This file is managed centrally by release-tools and should not be modified -# within individual charm repos. See the 'global' dir contents for available -# choices of *requirements.txt files for OpenStack Charms: -# https://github.com/openstack-charmers/release-tools -# - -# Functional Test Requirements (let Zaza's dependencies solve all dependencies here!) -git+https://github.com/openstack-charmers/zaza.git#egg=zaza -git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack diff --git a/src/tests/README.md b/src/tests/README.md deleted file mode 100644 index a8d9e14..0000000 --- a/src/tests/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Overview - -This directory provides Amulet tests to verify basic deployment functionality -from the perspective of this charm, its requirements and its features, as -exercised in a subset of the full OpenStack deployment test bundle topology. - -For full details on functional testing of OpenStack charms please refer to -the [functional testing](http://docs.openstack.org/developer/charm-guide/testing.html#functional-testing) -section of the OpenStack Charm Guide. \ No newline at end of file diff --git a/src/tests/basic_deployment.py b/src/tests/basic_deployment.py deleted file mode 100644 index aba3966..0000000 --- a/src/tests/basic_deployment.py +++ /dev/null @@ -1,151 +0,0 @@ -# Copyright 2016 Canonical Ltd -# -# 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 amulet -import json -import subprocess -import time - - -import charmhelpers.contrib.openstack.amulet.deployment as amulet_deployment -import charmhelpers.contrib.openstack.amulet.utils as os_amulet_utils - -# Use DEBUG to turn on debug logging -u = os_amulet_utils.OpenStackAmuletUtils(os_amulet_utils.DEBUG) - - -class PankoCharmDeployment(amulet_deployment.OpenStackAmuletDeployment): - - """Amulet tests on a basic panko deployment.""" - - def __init__(self, series, openstack=None, source=None, stable=False): - """Deploy the entire test environment.""" - super(PankoCharmDeployment, self).__init__(series, openstack, - source, stable) - self._add_services() - self._add_relations() - self._configure_services() - self._deploy() - - u.log.info('Waiting on extended status checks...') - exclude_services = ['percona-cluster', 'mongodb'] - self._auto_wait_for_status(exclude_services=exclude_services) - - self._initialize_tests() - - def _add_services(self): - """Add services - - Add the services that we're testing, where panko is local, - and the rest of the service are from lp branches that are - compatible with the local charm (e.g. stable or next). - """ - this_service = {'name': 'panko'} - other_services = [ - {'name': 'percona-cluster'}, - {'name': 'mongodb'}, - {'name': 'ceilometer'}, - {'name': 'keystone'}, - {'name': 'rabbitmq-server'}, - ] - super(PankoCharmDeployment, self)._add_services(this_service, - other_services) - - def _add_relations(self): - """Add all of the relations for the services.""" - relations = { - 'keystone:shared-db': 'percona-cluster:shared-db', - 'panko:identity-service': 'keystone:identity-service', - 'panko:shared-db': 'percona-cluster:shared-db', - 'ceilometer:identity-service': 'keystone:identity-service', - 'ceilometer:shared-db': 'mongodb:database', - 'ceilometer:amqp': 'rabbitmq-server:amqp', - } - super(PankoCharmDeployment, self)._add_relations(relations) - - def _configure_services(self): - """Configure all of the services.""" - keystone_config = {'admin-password': 'openstack', - 'admin-token': 'ubuntutesting'} - configs = {'keystone': keystone_config} - super(PankoCharmDeployment, self)._configure_services(configs) - - def _get_token(self): - return self.keystone.service_catalog.catalog['token']['id'] - - def _initialize_tests(self): - """Perform final initialization before tests get run.""" - # Access the sentries for inspecting service units - self.panko_sentry = self.d.sentry['panko'][0] - self.pxc_sentry = self.d.sentry['percona-cluster'][0] - self.keystone_sentry = self.d.sentry['keystone'][0] - self.panko_svcs = ['haproxy', 'apache2'] - - # Authenticate admin with keystone endpoint - self.keystone = u.authenticate_keystone_admin(self.keystone_sentry, - user='admin', - password='openstack', - tenant='admin') - - def check_and_wait(self, check_command, interval=2, max_wait=200, - desc=None): - waited = 0 - while not check_command() or waited > max_wait: - if desc: - u.log.debug(desc) - time.sleep(interval) - waited = waited + interval - if waited > max_wait: - raise Exception('cmd failed {}'.format(check_command)) - - def _run_action(self, unit_id, action, *args): - command = ["juju", "action", "do", "--format=json", unit_id, action] - command.extend(args) - output = subprocess.check_output(command) - output_json = output.decode(encoding="UTF-8") - data = json.loads(output_json) - action_id = data[u'Action queued with id'] - return action_id - - def _wait_on_action(self, action_id): - command = ["juju", "action", "fetch", "--format=json", action_id] - while True: - try: - output = subprocess.check_output(command) - except Exception as e: - print(e) - return False - output_json = output.decode(encoding="UTF-8") - data = json.loads(output_json) - if data[u"status"] == "completed": - return True - elif data[u"status"] == "failed": - return False - time.sleep(2) - - def test_100_services(self): - """Verify the expected services are running on the corresponding - service units.""" - u.log.debug('Checking system services on units...') - - service_names = { - self.panko_sentry: self.panko_svcs, - } - - ret = u.validate_services_by_name(service_names) - if ret: - amulet.raise_status(amulet.FAIL, msg=ret) - - u.log.debug('OK') diff --git a/src/tests/gate-basic-xenial-ocata b/src/tests/gate-basic-xenial-ocata deleted file mode 100755 index 03d2bbf..0000000 --- a/src/tests/gate-basic-xenial-ocata +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 Canonical Ltd -# -# 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. - -"""Amulet tests on a basic Panko Charm deployment on xenial-ocata.""" - -from basic_deployment import PankoCharmDeployment - -if __name__ == '__main__': - deployment = PankoCharmDeployment(series='xenial', - openstack='cloud:xenial-ocata') - deployment.run_tests() diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml deleted file mode 100644 index 8ba143b..0000000 --- a/src/tests/tests.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Bootstrap the model if necessary. -bootstrap: True -# Re-use bootstrap node instead of destroying/re-bootstrapping. -reset: True -# Use tox/requirements to drive the venv instead of bundletester's venv feature. -virtualenv: False -# Leave makefile empty, otherwise unit/lint tests will rerun ahead of amulet. -makefile: [] -# Do not specify juju PPA sources. Juju is presumed to be pre-installed -# and configured in all test runner environments. -#sources: -# Do not specify or rely on system packages. -#packages: -# Do not specify python packages here. Use test-requirements.txt -# and tox instead. ie. The venv is constructed before bundletester -# is invoked. -#python-packages: \ No newline at end of file diff --git a/src/tox.ini b/src/tox.ini deleted file mode 100644 index b40d295..0000000 --- a/src/tox.ini +++ /dev/null @@ -1,61 +0,0 @@ -# Source charm (with zaza): ./src/tox.ini -# This file is managed centrally by release-tools and should not be modified -# within individual charm repos. See the 'global' dir contents for available -# choices of tox.ini for OpenStack Charms: -# https://github.com/openstack-charmers/release-tools - -[tox] -envlist = pep8 -skipsdist = True -# NOTE: Avoid build/test env pollution by not enabling sitepackages. -sitepackages = False -# NOTE: Avoid false positives by not skipping missing interpreters. -skip_missing_interpreters = False -# NOTES: -# * We avoid the new dependency resolver by pinning pip < 20.3, see -# https://github.com/pypa/pip/issues/9187 -# * Pinning dependencies requires tox >= 3.2.0, see -# https://tox.readthedocs.io/en/latest/config.html#conf-requires -# * It is also necessary to pin virtualenv as a newer virtualenv would still -# lead to fetching the latest pip in the func* tox targets, see -# https://stackoverflow.com/a/38133283 -requires = pip < 20.3 - virtualenv < 20.0 -# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci -minversion = 3.18.0 - -[testenv] -setenv = VIRTUAL_ENV={envdir} - PYTHONHASHSEED=0 -allowlist_externals = juju -passenv = HOME TERM CS_* OS_* TEST_* -deps = -r{toxinidir}/test-requirements.txt -install_command = - pip install {opts} {packages} - -[testenv:pep8] -basepython = python3 -commands = charm-proof - -[testenv:func-noop] -basepython = python3 -commands = - functest-run-suite --help - -[testenv:func] -basepython = python3 -commands = - functest-run-suite --keep-model - -[testenv:func-smoke] -basepython = python3 -commands = - functest-run-suite --keep-model --smoke - -[testenv:func-target] -basepython = python3 -commands = - functest-run-suite --keep-model --bundle {posargs} - -[testenv:venv] -commands = {posargs} diff --git a/src/wheelhouse.txt b/src/wheelhouse.txt deleted file mode 100644 index f83126b..0000000 --- a/src/wheelhouse.txt +++ /dev/null @@ -1,2 +0,0 @@ -jinja2 -psutil diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index af069e1..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,51 +0,0 @@ -# This file is managed centrally by release-tools and should not be modified -# within individual charm repos. See the 'global' dir contents for available -# choices of *requirements.txt files for OpenStack Charms: -# https://github.com/openstack-charmers/release-tools -# -setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85 - -stestr>=2.2.0 - -# Dependency of stestr. Workaround for -# https://github.com/mtreinish/stestr/issues/145 -cliff<3.0.0 - -# Dependencies of stestr. Newer versions use keywords that didn't exist in -# python 3.5 yet (e.g. "ModuleNotFoundError") -importlib-metadata<3.0.0; python_version < '3.6' -importlib-resources<3.0.0; python_version < '3.6' - -# Some Zuul nodes sometimes pull newer versions of these dependencies which -# dropped support for python 3.5: -osprofiler<2.7.0;python_version<'3.6' -stevedore<1.31.0;python_version<'3.6' -debtcollector<1.22.0;python_version<'3.6' -oslo.utils<=3.41.0;python_version<'3.6' - -requests>=2.18.4 -charms.reactive - -# Newer mock seems to have some syntax which is newer than python3.5 (e.g. -# f'{something}' -mock>=1.2,<4.0.0; python_version < '3.6' -mock>=1.2; python_version >= '3.6' - -nose>=1.3.7 -coverage>=3.6 -git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack -# -# Revisit for removal / mock improvement: -# -# NOTE(lourot): newer versions of cryptography require a Rust compiler to build, -# see -# * https://github.com/openstack-charmers/zaza/issues/421 -# * https://mail.python.org/pipermail/cryptography-dev/2021-January/001003.html -# -netifaces # vault -psycopg2-binary # vault -tenacity # vault -pbr==5.6.0 # vault -cryptography<3.4 # vault, keystone-saml-mellon -lxml # keystone-saml-mellon -hvac # vault, barbican-vault diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 22159df..0000000 --- a/tox.ini +++ /dev/null @@ -1,118 +0,0 @@ -# Source charm: ./tox.ini -# This file is managed centrally by release-tools and should not be modified -# within individual charm repos. See the 'global' dir contents for available -# choices of tox.ini for OpenStack Charms: -# https://github.com/openstack-charmers/release-tools - -[tox] -skipsdist = True -envlist = pep8,py3 -# NOTE: Avoid build/test env pollution by not enabling sitepackages. -sitepackages = False -# NOTE: Avoid false positives by not skipping missing interpreters. -skip_missing_interpreters = False -# NOTES: -# * We avoid the new dependency resolver by pinning pip < 20.3, see -# https://github.com/pypa/pip/issues/9187 -# * Pinning dependencies requires tox >= 3.2.0, see -# https://tox.readthedocs.io/en/latest/config.html#conf-requires -# * It is also necessary to pin virtualenv as a newer virtualenv would still -# lead to fetching the latest pip in the func* tox targets, see -# https://stackoverflow.com/a/38133283 -requires = - pip < 20.3 - virtualenv < 20.0 - setuptools<50.0.0 - -# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci -minversion = 3.18.0 - -[testenv] -setenv = VIRTUAL_ENV={envdir} - PYTHONHASHSEED=0 - TERM=linux - LAYER_PATH={toxinidir}/layers - INTERFACE_PATH={toxinidir}/interfaces - JUJU_REPOSITORY={toxinidir}/build -passenv = http_proxy https_proxy INTERFACE_PATH LAYER_PATH JUJU_REPOSITORY -install_command = - {toxinidir}/pip.sh install {opts} {packages} -deps = - -r{toxinidir}/requirements.txt - -[testenv:build] -basepython = python3 -commands = - charm-build --log-level DEBUG --use-lock-file-branches -o {toxinidir}/build/builds src {posargs} - -[testenv:add-build-lock-file] -basepython = python3 -commands = - charm-build --log-level DEBUG --write-lock-file -o {toxinidir}/build/builds src {posargs} - -[testenv:py3] -basepython = python3 -deps = -r{toxinidir}/test-requirements.txt -commands = stestr run --slowest {posargs} - -[testenv:py35] -basepython = python3.5 -deps = -r{toxinidir}/test-requirements.txt -commands = stestr run --slowest {posargs} - -[testenv:py36] -basepython = python3.6 -deps = -r{toxinidir}/test-requirements.txt -commands = stestr run --slowest {posargs} - -[testenv:py37] -basepython = python3.7 -deps = -r{toxinidir}/test-requirements.txt -commands = stestr run --slowest {posargs} - -[testenv:py38] -basepython = python3.8 -deps = -r{toxinidir}/test-requirements.txt -commands = stestr run --slowest {posargs} - -[testenv:pep8] -basepython = python3 -deps = flake8==3.9.2 - charm-tools==2.8.3 -commands = flake8 {posargs} src unit_tests - -[testenv:cover] -# Technique based heavily upon -# https://github.com/openstack/nova/blob/master/tox.ini -basepython = python3 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt -setenv = - {[testenv]setenv} - PYTHON=coverage run -commands = - coverage erase - stestr run --slowest {posargs} - coverage combine - coverage html -d cover - coverage xml -o cover/coverage.xml - coverage report - -[coverage:run] -branch = True -concurrency = multiprocessing -parallel = True -source = - . -omit = - .tox/* - */charmhelpers/* - unit_tests/* - -[testenv:venv] -basepython = python3 -commands = {posargs} - -[flake8] -# E402 ignore necessary for path append before sys module import in actions -ignore = E402,W503,W504 diff --git a/unit_tests/__init__.py b/unit_tests/__init__.py deleted file mode 100644 index cb6010f..0000000 --- a/unit_tests/__init__.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2016 Canonical Ltd -# -# 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 sys - -sys.path.append('src') -sys.path.append('src/lib') - -# Mock out charmhelpers so that we can test without it. -import charms_openstack.test_mocks # noqa -charms_openstack.test_mocks.mock_charmhelpers() - - -def mock_more_stuff(): - charmhelpers = charms_openstack.test_mocks.charmhelpers - sys.modules['charmhelpers.contrib.storage'] = ( - charmhelpers.contrib.storage - ) - sys.modules['charmhelpers.contrib.storage.linux'] = ( - charmhelpers.contrib.storage.linux - ) - sys.modules['charmhelpers.contrib.storage.linux.ceph'] = ( - charmhelpers.contrib.storage.linux.ceph - ) - - -mock_more_stuff() diff --git a/unit_tests/test_panko_handlers.py b/unit_tests/test_panko_handlers.py deleted file mode 100644 index 7db138c..0000000 --- a/unit_tests/test_panko_handlers.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright 2016 Canonical Ltd -# -# 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. - -from __future__ import absolute_import -from __future__ import print_function - -import mock - -import charms_openstack.test_utils as test_utils - -import reactive.panko_handlers as handlers - - -class TestRegisteredHooks(test_utils.TestRegisteredHooks): - - def test_hooks(self): - defaults = [ - 'charm.installed', - 'shared-db.connected', - 'identity-service.connected', - 'identity-service.available', # enables SSL support - 'config.changed', - 'update-status'] - hook_set = { - 'when': { - 'render_config': ( - 'shared-db.available', - 'identity-service.available', - ), - 'init_db': ( - 'config.rendered', - ), - 'cluster_connected': ( - 'ha.connected', - ), - 'provide_panko_url': ( - 'event-service.connected', - 'config.rendered', - ), - }, - 'when_not': { - 'disable_services': ( - 'config.rendered', - ), - }, - } - # test that the hooks were registered via the - # reactive.panko_handlers - self.registered_hooks_test_helper(handlers, hook_set, defaults) - - -class TestHandlers(test_utils.PatchHelper): - - def setUp(self): - super(TestHandlers, self).setUp() - self.panko_charm = mock.MagicMock() - self.patch_object(handlers.charm, 'provide_charm_instance', - new=mock.MagicMock()) - self.provide_charm_instance().__enter__.return_value = \ - self.panko_charm - self.provide_charm_instance().__exit__.return_value = None - - def test_render_stuff(self): - handlers.render_config('arg1', 'arg2') - self.panko_charm.render_with_interfaces.assert_called_once_with( - ('arg1', 'arg2') - ) - self.panko_charm.assess_status.assert_called_once_with() - self.panko_charm.enable_apache2_site.assert_called_once_with() - - def test_init_db(self): - handlers.init_db() - self.panko_charm.db_sync.assert_called_once_with() - - def test_provide_panko_url(self): - mock_panko = mock.MagicMock() - self.panko_charm.public_url = "http://panko:8777" - handlers.provide_panko_url(mock_panko) - mock_panko.set_panko_url.assert_called_once_with( - "http://panko:8777" - ) - - def test_disable_services(self): - handlers.disable_services() - self.panko_charm.disable_services.assert_called_once_with()