From e86b00b917a176e6e300e4491965c7dd2cea801c Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Wed, 7 Jun 2017 14:44:33 -0500 Subject: [PATCH] Make validate-modules a .py file, and symlink back to validate-modules (#25227) * Make validate-modules a .py file, and symlink back to validate-modules * Set prog for argparse in valdiate-modules --- test/sanity/validate-modules/main.py | 1214 ++++++++++++++++ test/sanity/validate-modules/validate-modules | 1215 +---------------- 2 files changed, 1215 insertions(+), 1214 deletions(-) create mode 100755 test/sanity/validate-modules/main.py mode change 100755 => 120000 test/sanity/validate-modules/validate-modules diff --git a/test/sanity/validate-modules/main.py b/test/sanity/validate-modules/main.py new file mode 100755 index 00000000000..0c946c838e6 --- /dev/null +++ b/test/sanity/validate-modules/main.py @@ -0,0 +1,1214 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2015 Matt Martz +# Copyright (C) 2015 Rackspace US, Inc. +# +# This program 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 program 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 program. If not, see . + +from __future__ import print_function + +import abc +import argparse +import ast +import json +import os +import re +import subprocess +import sys +import tempfile +import traceback + +from collections import OrderedDict +from contextlib import contextmanager +from distutils.version import StrictVersion +from fnmatch import fnmatch + +from ansible import __version__ as ansible_version +from ansible.executor.module_common import REPLACER_WINDOWS +from ansible.utils.plugin_docs import BLACKLIST, get_docstring + +from module_args import get_argument_spec + +from schema import doc_schema, metadata_schema, return_schema + +from utils import CaptureStd, parse_yaml +from voluptuous.humanize import humanize_error + +from ansible.module_utils.six import PY3, with_metaclass + +if PY3: + # Because there is no ast.TryExcept in Python 3 ast module + TRY_EXCEPT = ast.Try + # REPLACER_WINDOWS from ansible.executor.module_common is byte + # string but we need unicode for Python 3 + REPLACER_WINDOWS = REPLACER_WINDOWS.decode('utf-8') +else: + TRY_EXCEPT = ast.TryExcept + +BLACKLIST_DIRS = frozenset(('.git', 'test', '.github', '.idea')) +INDENT_REGEX = re.compile(r'([\t]*)') +TYPE_REGEX = re.compile(r'.*(if|or)(\s+[^"\']*|\s+)(? -# Copyright (C) 2015 Rackspace US, Inc. -# -# This program 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 program 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 program. If not, see . - -from __future__ import print_function - -import abc -import argparse -import ast -import json -import os -import re -import subprocess -import sys -import tempfile -import traceback - -from collections import OrderedDict -from contextlib import contextmanager -from distutils.version import StrictVersion -from fnmatch import fnmatch - -from ansible import __version__ as ansible_version -from ansible.executor.module_common import REPLACER_WINDOWS -from ansible.utils.plugin_docs import BLACKLIST, get_docstring - -from module_args import get_argument_spec - -from schema import doc_schema, metadata_schema, return_schema - -from utils import CaptureStd, parse_yaml -from voluptuous.humanize import humanize_error - -from ansible.module_utils.six import PY3, with_metaclass - -if PY3: - # Because there is no ast.TryExcept in Python 3 ast module - TRY_EXCEPT = ast.Try - # REPLACER_WINDOWS from ansible.executor.module_common is byte - # string but we need unicode for Python 3 - REPLACER_WINDOWS = REPLACER_WINDOWS.decode('utf-8') -else: - TRY_EXCEPT = ast.TryExcept - -BLACKLIST_DIRS = frozenset(('.git', 'test', '.github', '.idea')) -INDENT_REGEX = re.compile(r'([\t]*)') -TYPE_REGEX = re.compile(r'.*(if|or)(\s+[^"\']*|\s+)(?