diff --git a/.gitignore b/.gitignore index e69de29..d7be4db 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/ansible-review-0.7.2.tar.gz diff --git a/0001-backport-to-ansible-lint-2.x.patch b/0001-backport-to-ansible-lint-2.x.patch new file mode 100644 index 0000000..66f0554 --- /dev/null +++ b/0001-backport-to-ansible-lint-2.x.patch @@ -0,0 +1,60 @@ +From 55af6e76c3c2258dca11141d49852745361a5855 Mon Sep 17 00:00:00 2001 +From: Dan Callaghan +Date: Wed, 22 Jun 2016 14:13:12 +1000 +Subject: [PATCH] backport to ansible-lint 2.x + +--- + lib/ansiblereview/__init__.py | 5 ++++- + lib/ansiblereview/playbook.py | 2 +- + setup.py | 2 +- + 3 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/lib/ansiblereview/__init__.py b/lib/ansiblereview/__init__.py +index dbf8d54..fc1aa07 100644 +--- a/lib/ansiblereview/__init__.py ++++ b/lib/ansiblereview/__init__.py +@@ -1,4 +1,4 @@ +-from ansiblelint import default_rulesdir, RulesCollection ++from ansiblelint import RulesCollection + import codecs + from functools import partial + import re +@@ -10,6 +10,9 @@ + except ImportError: + from ansible.utils import module_finder as module_loader + ++import pkg_resources ++default_rulesdir = pkg_resources.resource_filename('ansiblelint', 'rules') ++ + + class AnsibleReviewFormatter(object): + +diff --git a/lib/ansiblereview/playbook.py b/lib/ansiblereview/playbook.py +index facf011..3c0d003 100644 +--- a/lib/ansiblereview/playbook.py ++++ b/lib/ansiblereview/playbook.py +@@ -42,7 +42,7 @@ def review(playbook, settings): + + def repeated_names(playbook, settings): + with codecs.open(playbook['path'], mode='rb', encoding='utf-8') as f: +- yaml = ansiblelint.utils.parse_yaml_linenumbers(f, playbook['path']) ++ yaml = ansiblelint.utils.parse_yaml_linenumbers(f) + namelines = defaultdict(list) + errors = [] + if yaml: +diff --git a/setup.py b/setup.py +index 43aa3c3..97e3815 100644 +--- a/setup.py ++++ b/setup.py +@@ -19,7 +19,7 @@ + package_dir={'': 'lib'}, + packages=find_packages('lib'), + zip_safe=False, +- install_requires=['ansible-lint>=3.0.0rc11', 'pyyaml', 'appdirs', 'unidiff'], ++ install_requires=['ansible-lint<3', 'pyyaml', 'appdirs', 'unidiff'], + scripts=['bin/ansible-review'], + classifiers=[ + 'License :: OSI Approved :: MIT License', +-- +2.4.11 + diff --git a/ansible-review.spec b/ansible-review.spec new file mode 100644 index 0000000..dca50ef --- /dev/null +++ b/ansible-review.spec @@ -0,0 +1,47 @@ +Name: ansible-review +Version: 0.7.2 +Release: 1%{?dist} +Summary: Reviews Ansible playbooks, roles and inventory and suggests improvements +License: MIT +URL: https://github.com/willthames/ansible-review +Source0: https://files.pythonhosted.org/packages/source/a/%{name}/%{name}-%{version}.tar.gz +BuildArch: noarch +BuildRequires: python2-devel +BuildRequires: python2-nose +BuildRequires: python-flake8 +Requires: ansible-lint +Requires: python2-yaml +Requires: python-appdirs +Requires: python2-unidiff +# Only until ansible-lint 3.x lands in Fedora +Patch1: 0001-backport-to-ansible-lint-2.x.patch + +%description +Tool to review Ansible playbooks, roles, and inventory and suggest improvements. + +%prep +%setup -q +rm -r lib/ansible_review.egg-info +sed -e '1 { /^#!/d }' -i lib/ansiblereview/utils/yamlindent.py +%patch1 -p1 + +%build +%py2_build + +%install +%py2_install + +%check +# Tests fail due to missing test/test_cases/hosts: +# https://github.com/willthames/ansible-review/pull/2 +#nosetests -v test/ + +%files +%doc README.md LICENSE +%{_bindir}/%{name} +%{python2_sitelib}/ansiblereview +%{python2_sitelib}/ansible_review*.egg-info + +%changelog +* Wed Jun 22 2016 Dan Callaghan - 0.7.2-1 +- initial version diff --git a/sources b/sources index e69de29..7a059c2 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +6d6f66572564624da061f9bbf104edee ansible-review-0.7.2.tar.gz