From b35f47190a0674e44e4b5d38b8062fc717fb4cf0 Mon Sep 17 00:00:00 2001 From: Tobias Henkel Date: Thu, 18 Oct 2018 09:11:38 +0000 Subject: [PATCH] Revert "Extract pep8 messages for inline comments" There seems to be a problem with openstack-zuul-jobs [1]. This reverts commit 421f533b6171ea6140e0967a75765cb73404241f. [1] http://logs.openstack.org/86/610386/3/gate/openstack-zuul-jobs-linters/a8c857d/job-output.txt.gz#_2018-10-18_07_14_42_431592 Change-Id: Iac5236221e33df4613cc2f7a2edcffc323902320 --- roles/tox/library/tox_parse_output.py | 75 --------------------------- roles/tox/tasks/main.yaml | 23 -------- test-requirements.txt | 1 + tox.ini | 4 -- 4 files changed, 1 insertion(+), 102 deletions(-) delete mode 100644 roles/tox/library/tox_parse_output.py diff --git a/roles/tox/library/tox_parse_output.py b/roles/tox/library/tox_parse_output.py deleted file mode 100644 index 7a77f11f7..000000000 --- a/roles/tox/library/tox_parse_output.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2018 Red Hat -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see . -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: tox_parse_output -short_description: Parses the output of tox looking for per-line comments -author: Monty Taylor (@mordred) -description: - - Looks for output from the tox command to find content that could be - returned as inline comments. -requirements: - - "python >= 3.5" -options: - tox_output: - description: - - Output from the tox command run - required: true - type: str -''' -from ansible.module_utils.basic import AnsibleModule - - -def extract_file_comments(tox_output): - ret = {} - for line in tox_output.split('\n'): - try: - if not line: - continue - if line[0].isspace(): - continue - if ': ' not in line: - continue - (file_info, message) = line.split(': ', 1) - (file_path, start_line, start_char) = file_info.split(':') - if file_path.startswith('./'): - file_path = file_path[2:] - ret.setdefault(file_path, []) - ret[file_path].append(dict(line=int(start_line), - message=message)) - except Exception: - pass - return ret - - -def main(): - module = AnsibleModule( - argument_spec=dict( - tox_output=dict(required=True, type='str'), - ) - ) - tox_output = module.params['tox_output'] - - file_comments = extract_file_comments(tox_output) - module.exit_json(changed=False, file_comments=file_comments) - - -if __name__ == '__main__': - main() diff --git a/roles/tox/tasks/main.yaml b/roles/tox/tasks/main.yaml index 3c4a7b017..b1f464fb8 100644 --- a/roles/tox/tasks/main.yaml +++ b/roles/tox/tasks/main.yaml @@ -36,26 +36,3 @@ chdir: "{{ zuul_work_dir }}" environment: "{{ tox_environment|combine(tox_constraints_env|default({})) }}" command: "{{ tox_executable }} -e{{ tox_envlist }} {{ tox_extra_args }}" - failed_when: false - register: tox_output - -- name: Look for output - tox_parse_output: - tox_output: '{{ tox_output.stdout }}' - register: file_comments - -- name: Return file comments to Zuul - when: file_comments.file_comments - delegate_to: localhost - zuul_return: - data: - zuul: - file_comments: '{{ file_comments.file_comments }}' - tags: - # Avoid "no action detected in task" linter error - - skip_ansible_lint - -- name: Return tox status - fail: - msg: 'tox exited with return code {{ tox_output.rc }}' - when: tox_output.rc != 0 diff --git a/test-requirements.txt b/test-requirements.txt index d7feb5675..25adbc263 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,6 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. flake8 +zuul # We need to pin the ansible version directly here; per the # deprecation policy it should trail the version used by Zuul by 4 diff --git a/tox.ini b/tox.ini index bcc1fd8fb..3e3dbdea7 100644 --- a/tox.ini +++ b/tox.ini @@ -26,10 +26,6 @@ commands = sphinx-build -E -W -d doc/build/doctrees -b html doc/source/ doc/build/html [testenv:linters] -deps = - # Zuul is required to supply the zuul ansible modules for ansible-lint - -r{toxinidir}/test-requirements.txt - -egit+https://git.openstack.org/openstack-infra/zuul#egg=zuul passenv = # NOTE(pabelanger): if you'd like to run tox -elinters locally, you'll need # to export ANSIBLE_ROLES_PATH pointing to the currect repos.