mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 22:30:22 -07:00
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:
parent
1718719d77
commit
829c0b8f62
178 changed files with 1849 additions and 1783 deletions
|
@ -1,58 +1,21 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
"""LogicMonitor Ansible module for managing Collectors, Hosts and Hostgroups
|
||||
Copyright (C) 2015 LogicMonitor
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA"""
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import platform
|
||||
import socket
|
||||
import sys
|
||||
import types
|
||||
import urllib
|
||||
|
||||
HAS_LIB_JSON = True
|
||||
try:
|
||||
import json
|
||||
# Detect the python-json library which is incompatible
|
||||
# Look for simplejson if that's the case
|
||||
try:
|
||||
if (
|
||||
not isinstance(json.loads, types.FunctionType) or
|
||||
not isinstance(json.dumps, types.FunctionType)
|
||||
):
|
||||
raise ImportError
|
||||
except AttributeError:
|
||||
raise ImportError
|
||||
except ImportError:
|
||||
try:
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
print(
|
||||
'\n{"msg": "Error: ansible requires the stdlib json or ' +
|
||||
'simplejson module, neither was found!", "failed": true}'
|
||||
)
|
||||
HAS_LIB_JSON = False
|
||||
except SyntaxError:
|
||||
print(
|
||||
'\n{"msg": "SyntaxError: probably due to installed simplejson ' +
|
||||
'being for a different python version", "failed": true}'
|
||||
)
|
||||
HAS_LIB_JSON = False
|
||||
# LogicMonitor Ansible module for managing Collectors, Hosts and Hostgroups
|
||||
# Copyright (C) 2015 LogicMonitor
|
||||
#
|
||||
# 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, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
RETURN = '''
|
||||
---
|
||||
|
@ -555,6 +518,36 @@ EXAMPLES = '''
|
|||
delegate_to: localhost
|
||||
'''
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import platform
|
||||
import socket
|
||||
import sys
|
||||
import types
|
||||
import urllib
|
||||
|
||||
HAS_LIB_JSON = True
|
||||
try:
|
||||
import json
|
||||
# Detect the python-json library which is incompatible
|
||||
# Look for simplejson if that's the case
|
||||
try:
|
||||
if (
|
||||
not isinstance(json.loads, types.FunctionType) or
|
||||
not isinstance(json.dumps, types.FunctionType)
|
||||
):
|
||||
raise ImportError
|
||||
except AttributeError:
|
||||
raise ImportError
|
||||
except ImportError:
|
||||
try:
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
HAS_LIB_JSON = False
|
||||
except SyntaxError:
|
||||
HAS_LIB_JSON = False
|
||||
|
||||
|
||||
|
||||
class LogicMonitor(object):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue