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 6577ff5f85
commit 9730157525
23 changed files with 598 additions and 402 deletions

View file

@ -60,6 +60,7 @@ import grp
import pwd
import platform
import errno
import tempfile
try:
import json
@ -115,6 +116,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()
@ -189,7 +191,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()
@ -572,8 +574,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)
@ -1093,4 +1096,3 @@ class AnsibleModule(object):
break
return '%.2f %s' % (float(size)/ limit, suffix)