Update validate-modules (#20932)

* Update validate-modules

* Validates ANSIBLE_METADATA
* Ensures imports happen after documentation vars
* Some pep8 cleanup

* Clean up some left over unneeded code

* Update modules for new module guidelines and validate-modules checks

* Update imports for ec2_vpc_route_table and ec2_vpc_nat_gateway
This commit is contained in:
Matt Martz
2017-02-02 13:45:22 -06:00
committed by Matt Clay
parent 1718719d77
commit 829c0b8f62
178 changed files with 1849 additions and 1783 deletions

View File

@@ -16,9 +16,10 @@
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from ansible.module_utils.basic import AnsibleModule, BOOLEANS_TRUE
from ansible.module_utils.pycompat24 import get_exception
import subprocess
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = """
module: gconftool2
@@ -101,6 +102,10 @@ RETURN = '''
...
'''
from ansible.module_utils.basic import AnsibleModule, BOOLEANS_TRUE
from ansible.module_utils.pycompat24 import get_exception
import subprocess
class GConf2Preference(object):
def __init__(self, ansible, key, value_type, value,

View File

@@ -18,10 +18,6 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import os
import re
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
@@ -61,6 +57,9 @@ EXAMPLES = '''
state: present
'''
import os
import re
class Blacklist(object):
def __init__(self, module, filename):

View File

@@ -18,11 +18,6 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import os
import os.path
import shutil
import re
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
@@ -116,6 +111,12 @@ EXAMPLES = '''
comment: unlimited memory lock for james
'''
import os
import os.path
import shutil
import re
def main():
pam_items = [ 'core', 'data', 'fsize', 'memlock', 'nofile', 'rss', 'stack', 'cpu', 'nproc', 'as', 'maxlogins', 'maxsyslogins', 'priority', 'locks', 'sigpending', 'msgqueue', 'nice', 'rtprio', 'chroot' ]

View File

@@ -16,8 +16,10 @@
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = """
module: pamd
@@ -196,6 +198,9 @@ dest:
...
'''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
# The PamdRule class encapsulates a rule in a pam.d service
class PamdRule(object):

View File

@@ -15,20 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this software. If not, see <http://www.gnu.org/licenses/>.
import os
import pipes
import stat
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
# Let snippet from module_utils/basic.py return a proper error in this case
pass
ANSIBLE_METADATA = {'status': ['stableinterface'],
'supported_by': 'community',
'version': '1.0'}
@@ -127,6 +113,19 @@ EXAMPLES = '''
tags: update,nginx
'''
import os
import pipes
import stat
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
# Let snippet from module_utils/basic.py return a proper error in this case
pass
def _get_facter_dir():
if os.getuid() == 0:

View File

@@ -17,11 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import sys
import os
import platform
import tempfile
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
@@ -159,6 +154,12 @@ EXAMPLES = '''
attach_options: -u
'''
import sys
import os
import platform
import tempfile
class Zone(object):
def __init__(self, module):
self.changed = False

View File

@@ -18,16 +18,6 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import os
import platform
import random
import re
import string
from ansible.module_utils.basic import AnsibleModule, get_platform
from ansible.module_utils.six import iteritems
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'committer',
'version': '1.0'}
@@ -89,6 +79,15 @@ EXAMPLES = '''
name: Asia/Tokyo
'''
import os
import platform
import random
import re
import string
from ansible.module_utils.basic import AnsibleModule, get_platform
from ansible.module_utils.six import iteritems
class Timezone(object):
"""This is a generic Timezone manipulation class that is subclassed based on platform.