Validate SSL certs accessed through urllib*

* Adds another module utility file which generalizes the
  access of urls via the urllib* libraries.
* Adds a new spec generator for common arguments.
* Makes the user-agent string configurable.

Fixes #6211
This commit is contained in:
James Cammarata 2014-03-10 16:06:52 -05:00
parent c920f78cc3
commit 5bc6eafba5
23 changed files with 598 additions and 402 deletions

View file

@ -59,6 +59,7 @@ import grp
import pwd
import platform
import errno
import tempfile
try:
import json
@ -114,6 +115,7 @@ FILE_COMMON_ARGUMENTS=dict(
remote_src = dict(), # used by assemble
)
def get_platform():
''' what's the platform? example: Linux is a platform. '''
return platform.system()
@ -188,7 +190,7 @@ class AnsibleModule(object):
os.environ['LANG'] = MODULE_LANG
(self.params, self.args) = self._load_params()
self._legal_inputs = [ 'CHECKMODE', 'NO_LOG' ]
self._legal_inputs = ['CHECKMODE', 'NO_LOG']
self.aliases = self._handle_aliases()
@ -571,8 +573,9 @@ class AnsibleModule(object):
def _check_invalid_arguments(self):
for (k,v) in self.params.iteritems():
if k in ('CHECKMODE', 'NO_LOG'):
continue
# these should be in legal inputs already
#if k in ('CHECKMODE', 'NO_LOG'):
# continue
if k not in self._legal_inputs:
self.fail_json(msg="unsupported parameter for module: %s" % k)
@ -1068,4 +1071,3 @@ class AnsibleModule(object):
break
return '%.2f %s' % (float(size)/ limit, suffix)