* Add sanity test to ensure all non-py files are installed
* Fix mode and regex
* Fix role skel inventory package_data
* Add docs
* Update package_data for inventory files
* Address pylint concerns
* Another tweak to package_data
* Address review feedback
* Change index to 1
* add to ansible-only.txt
0 | 5 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,48 @@ |
0 |
+#!/usr/bin/env python |
|
1 |
+from __future__ import (absolute_import, division, print_function) |
|
2 |
+__metaclass__ = type |
|
3 |
+ |
|
4 |
+import fnmatch |
|
5 |
+import os |
|
6 |
+import re |
|
7 |
+import tempfile |
|
8 |
+import subprocess |
|
9 |
+ |
|
10 |
+ |
|
11 |
+def main(): |
|
12 |
+ ignore_files = frozenset(( |
|
13 |
+ '*/.git_keep', |
|
14 |
+ '*/galaxy/data/default/role/*/main.yml.j2', |
|
15 |
+ '*/galaxy/data/default/role/*/test.yml.j2', |
|
16 |
+ '*/galaxy/data/default/collection/plugins/README.md.j2', |
|
17 |
+ )) |
|
18 |
+ |
|
19 |
+ non_py_files = [] |
|
20 |
+ for root, _dummy, files in os.walk('lib/ansible/'): |
|
21 |
+ for filename in files: |
|
22 |
+ path = os.path.join(root, filename) |
|
23 |
+ if os.path.splitext(path)[1] not in ('.py', '.pyc', '.pyo'): |
|
24 |
+ add = True |
|
25 |
+ for ignore in ignore_files: |
|
26 |
+ if fnmatch.fnmatch(path, ignore): |
|
27 |
+ add = False |
|
28 |
+ if add: |
|
29 |
+ non_py_files.append(os.path.relpath(path, 'lib/ansible')) |
|
30 |
+ |
|
31 |
+ with tempfile.TemporaryDirectory() as tmp_dir: |
|
32 |
+ stdout, _dummy = subprocess.Popen( |
|
33 |
+ ['python', 'setup.py', 'install', '--root=%s' % tmp_dir], |
|
34 |
+ stdout=subprocess.PIPE, |
|
35 |
+ stderr=subprocess.PIPE, |
|
36 |
+ universal_newlines=True, |
|
37 |
+ ).communicate() |
|
38 |
+ match = re.search('^creating (%s/.*?/(?:site|dist)-packages/ansible)$' % tmp_dir, stdout, flags=re.M) |
|
39 |
+ |
|
40 |
+ for filename in non_py_files: |
|
41 |
+ path = os.path.join(match.group(1), filename) |
|
42 |
+ if not os.path.exists(path): |
|
43 |
+ print('%s: File not installed' % os.path.join('lib', 'ansible', filename)) |
|
44 |
+ |
|
45 |
+ |
|
46 |
+if __name__ == '__main__': |
|
47 |
+ main() |
... | ... |
@@ -17,7 +17,7 @@ fi |
17 | 17 |
|
18 | 18 |
case "${group}" in |
19 | 19 |
1) options=(--skip-test pylint --skip-test ansible-doc --skip-test docs-build) ;; |
20 |
- 2) options=(--test ansible-doc --test docs-build) ;; |
|
20 |
+ 2) options=(--test ansible-doc --test docs-build --test package-data) ;; |
|
21 | 21 |
3) options=(--test pylint --exclude test/units/ --exclude lib/ansible/module_utils/ --exclude lib/ansible/modules/network/) ;; |
22 | 22 |
4) options=(--test pylint test/units/ lib/ansible/module_utils/ lib/ansible/modules/network/) ;; |
23 | 23 |
esac |