diff --git a/doc/source/roles/role-test_json_error_callback.rst b/doc/source/roles/role-test_json_error_callback.rst deleted file mode 100644 index abc2dc852..000000000 --- a/doc/source/roles/role-test_json_error_callback.rst +++ /dev/null @@ -1,15 +0,0 @@ -=============================================== -TripleO-Ansible Role - test_json_error_callback -=============================================== - -This role provides for the following services: - - * test_json_error_callback - - -Example playbook -~~~~~~~~~~~~~~~~ - -.. literalinclude:: ../../../tripleo_ansible/roles/test_json_error_callback/molecule/default/playbook.yml - :language: yaml - :start-after: under the License. diff --git a/tox.ini b/tox.ini index 5ebb26783..294f37001 100644 --- a/tox.ini +++ b/tox.ini @@ -127,17 +127,6 @@ envdir = {toxworkdir}/mol commands = python -m pytest --color=yes --html={envlogdir}/reports.html --self-contained-html {tty:-s} {toxinidir}/tests/test_molecule.py -[testenv:mol-test_json_error_callback] -setenv = - {[testenv]setenv} - JSON_ERROR_LOG_FILE=/tmp/json_error.log - ANSIBLE_LOAD_CALLBACK_PLUGINS=true - ANSIBLE_CALLBACK_WHITELIST=json_error -basepython = {[testenv:mol]basepython} -deps = {[testenv:mol]deps} -changedir = {toxinidir}/tripleo_ansible/roles/test_json_error_callback -commands = python -m pytest --color=yes --html={envlogdir}/reports.html --self-contained-html {tty:-s} {toxinidir}/tests/test_molecule.py - [testenv:mol-test_package_action] basepython = {[testenv:mol]basepython} deps = {[testenv:mol]deps} diff --git a/tripleo_ansible/ansible_plugins/callback/.gitkeep b/tripleo_ansible/ansible_plugins/callback/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tripleo_ansible/ansible_plugins/callback/json_error.py b/tripleo_ansible/ansible_plugins/callback/json_error.py deleted file mode 100644 index 9431505f8..000000000 --- a/tripleo_ansible/ansible_plugins/callback/json_error.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2018 Red Hat, Inc. -# All Rights Reserved. -# -# 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. - -# Ansible has another callback plugin just called "json.py", which overrides -# a normal import of "import json", so use absolute imports -from __future__ import absolute_import -import json -import os - -from ansible.plugins.callback import CallbackBase - - -DOCUMENTATION = ''' - callback: json_error - short_description: Write errors in JSON format to a log file - description: - - This callback writes errors in JSON format to a log file - type: aggregate - options: - output_dir: - name: json-error log file - default: ansible-error.json - description: Log file where to write errors in JSON format. - env: - - name: JSON_ERROR_LOG_FILE -''' - - -class CallbackModule(CallbackBase): - CALLBACK_VERSION = 2.5 - CALLBACK_TYPE = 'aggregate' - CALLBACK_NAME = 'json-error' - - def __init__(self, display=None): - super(CallbackModule, self).__init__(display) - self.errors = {} - self.log_file = os.getenv( - 'JSON_ERROR_LOG_FILE', 'ansible-errors.json') - - def v2_playbook_on_stats(self, stats): - with open(self.log_file, 'w') as f: - f.write(json.dumps(self.errors)) - - def v2_runner_on_failed(self, result, ignore_errors=False): - if not ignore_errors: - host_errors = self.errors.setdefault(result._host.name, []) - host_errors.append((result.task_name, result._result)) diff --git a/tripleo_ansible/roles/test_json_error_callback/README.md b/tripleo_ansible/roles/test_json_error_callback/README.md deleted file mode 100644 index 4a9078b0d..000000000 --- a/tripleo_ansible/roles/test_json_error_callback/README.md +++ /dev/null @@ -1,4 +0,0 @@ -test_json_error_callback -======================== - -Role to test the json_error callback plugin. diff --git a/tripleo_ansible/roles/test_json_error_callback/meta/main.yml b/tripleo_ansible/roles/test_json_error_callback/meta/main.yml deleted file mode 100644 index fac6bfa40..000000000 --- a/tripleo_ansible/roles/test_json_error_callback/meta/main.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- -# Copyright 2019 Red Hat, Inc. -# All Rights Reserved. -# -# 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. - - -galaxy_info: - author: OpenStack - description: TripleO OpenStack Role -- test_json_error_callback - company: Red Hat - license: Apache-2.0 - min_ansible_version: 2.7 - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - platforms: - - name: Fedora - versions: - - 28 - - name: CentOS - versions: - - 7 - - galaxy_tags: - - tripleo - - -# List your role dependencies here, one per line. Be sure to remove the '[]' above, -# if you add dependencies to this list. -dependencies: [] diff --git a/tripleo_ansible/roles/test_json_error_callback/molecule/default/Dockerfile b/tripleo_ansible/roles/test_json_error_callback/molecule/default/Dockerfile deleted file mode 100644 index fcdbd2990..000000000 --- a/tripleo_ansible/roles/test_json_error_callback/molecule/default/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -# Molecule managed -# Copyright 2019 Red Hat, Inc. -# All Rights Reserved. -# -# 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. - - -{% if item.registry is defined %} -FROM {{ item.registry.url }}/{{ item.image }} -{% else %} -FROM {{ item.image }} -{% endif %} - -RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ - elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \ - elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ - elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \ - elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \ - elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi - -{% for pkg in item.easy_install | default([]) %} -# install pip for centos where there is no python-pip rpm in default repos -RUN easy_install {{ pkg }} -{% endfor %} - - -CMD ["sh", "-c", "while true; do sleep 10000; done"] \ No newline at end of file diff --git a/tripleo_ansible/roles/test_json_error_callback/molecule/default/molecule.yml b/tripleo_ansible/roles/test_json_error_callback/molecule/default/molecule.yml deleted file mode 100644 index 513dcec24..000000000 --- a/tripleo_ansible/roles/test_json_error_callback/molecule/default/molecule.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -driver: - name: docker - -log: true - -platforms: - - name: centos7 - hostname: centos7 - image: centos:7 - dockerfile: Dockerfile - pkg_extras: python-setuptools - easy_install: - - pip - environment: &env - http_proxy: "{{ lookup('env', 'http_proxy') }}" - https_proxy: "{{ lookup('env', 'https_proxy') }}" - volumes: - - /tmp:/tmp - - - name: fedora28 - hostname: fedora28 - image: fedora:28 - dockerfile: Dockerfile - pkg_extras: python*-setuptools - environment: - <<: *env - volumes: - - /tmp:/tmp - -provisioner: - name: ansible - log: true - env: - ANSIBLE_STDOUT_CALLBACK: yaml - -scenario: - test_sequence: - - destroy - - create - - prepare - - converge - - verify - - destroy - -lint: - enabled: false - -verifier: - name: testinfra - lint: - name: flake8 diff --git a/tripleo_ansible/roles/test_json_error_callback/molecule/default/playbook.yml b/tripleo_ansible/roles/test_json_error_callback/molecule/default/playbook.yml deleted file mode 100644 index 6f09cc422..000000000 --- a/tripleo_ansible/roles/test_json_error_callback/molecule/default/playbook.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -# Copyright 2019 Red Hat, Inc. -# All Rights Reserved. -# -# 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. - - -- name: Converge - hosts: all - roles: - - role: "test_json_error_callback" diff --git a/tripleo_ansible/roles/test_json_error_callback/molecule/default/prepare.yml b/tripleo_ansible/roles/test_json_error_callback/molecule/default/prepare.yml deleted file mode 100644 index ef85c3128..000000000 --- a/tripleo_ansible/roles/test_json_error_callback/molecule/default/prepare.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -# Copyright 2019 Red Hat, Inc. -# All Rights Reserved. -# -# 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. - - -- name: Prepare - hosts: all - roles: - - role: test_deps diff --git a/tripleo_ansible/roles/test_json_error_callback/molecule/default/tests/test_default.py b/tripleo_ansible/roles/test_json_error_callback/molecule/default/tests/test_default.py deleted file mode 100644 index fc8d1b11c..000000000 --- a/tripleo_ansible/roles/test_json_error_callback/molecule/default/tests/test_default.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2019 Red Hat, Inc. -# All Rights Reserved. -# -# 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 testinfra.utils.ansible_runner - - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') - - -def test_for_logfile(host): - assert host.file("/tmp/json_error.log").exists diff --git a/tripleo_ansible/roles/test_json_error_callback/molecule/default/verify.yml b/tripleo_ansible/roles/test_json_error_callback/molecule/default/verify.yml deleted file mode 100644 index dfd4c7352..000000000 --- a/tripleo_ansible/roles/test_json_error_callback/molecule/default/verify.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# Copyright 2019 Red Hat, Inc. -# All Rights Reserved. -# -# 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/tripleo_ansible/roles/test_json_error_callback/tasks/main.yml b/tripleo_ansible/roles/test_json_error_callback/tasks/main.yml deleted file mode 100644 index 8feb7a367..000000000 --- a/tripleo_ansible/roles/test_json_error_callback/tasks/main.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -# Copyright 2019 Red Hat, Inc. -# All Rights Reserved. -# -# 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. - - -- name: Force error - package: - name: bison - state: notastate - ignore_errors: true diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 86fc8417c..09a30e968 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -22,14 +22,6 @@ vars: tox_envlist: mol-test_deps -- job: - name: tripleo-ansible-centos-7-molecule-test_json_error_callback - parent: tripleo-ansible-centos - files: - - ^tripleo_ansible/roles/test_json_error_callback/.* - vars: - tox_envlist: mol-test_json_error_callback - - job: name: tripleo-ansible-centos-7-molecule-test_package_action parent: tripleo-ansible-centos @@ -42,6 +34,9 @@ - job: name: tripleo-ansible-centos-7-molecule-tuned parent: tripleo-ansible-centos + description: | + Run molecule tests. Uses tox with the ``mol-tuned`` environment. + voting: true files: - ^tripleo_ansible/roles/tuned/.* vars: diff --git a/zuul.d/layout.yaml b/zuul.d/layout.yaml index 817c2a9a5..de152a5b2 100644 --- a/zuul.d/layout.yaml +++ b/zuul.d/layout.yaml @@ -4,7 +4,6 @@ jobs: - openstack-tox-linters - tripleo-ansible-centos-7-molecule-test_deps - - tripleo-ansible-centos-7-molecule-test_json_error_callback - tripleo-ansible-centos-7-molecule-test_package_action - tripleo-ansible-centos-7-molecule-tuned - tripleo-ansible-docs