|
|
@ -609,6 +609,7 @@ class AnsibleModule(object):
|
|
|
|
'float': self._check_type_float,
|
|
|
|
'float': self._check_type_float,
|
|
|
|
'path': self._check_type_path,
|
|
|
|
'path': self._check_type_path,
|
|
|
|
'raw': self._check_type_raw,
|
|
|
|
'raw': self._check_type_raw,
|
|
|
|
|
|
|
|
'jsonarg': self._check_type_jsonarg,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if not bypass_checks:
|
|
|
|
if not bypass_checks:
|
|
|
|
self._check_required_arguments()
|
|
|
|
self._check_required_arguments()
|
|
|
@ -1395,6 +1396,16 @@ class AnsibleModule(object):
|
|
|
|
value = self._check_type_str(value)
|
|
|
|
value = self._check_type_str(value)
|
|
|
|
return os.path.expanduser(os.path.expandvars(value))
|
|
|
|
return os.path.expanduser(os.path.expandvars(value))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _check_type_jsonarg(self, value):
|
|
|
|
|
|
|
|
# Return a jsonified string. Sometimes the controller turns a json
|
|
|
|
|
|
|
|
# string into a dict/list so transform it back into json here
|
|
|
|
|
|
|
|
if isinstance(value, (unicode, bytes)):
|
|
|
|
|
|
|
|
return value
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if isinstance(value (list, tuple, dict)):
|
|
|
|
|
|
|
|
return json.dumps(value)
|
|
|
|
|
|
|
|
raise TypeError('%s cannot be converted to a json string' % type(value))
|
|
|
|
|
|
|
|
|
|
|
|
def _check_type_raw(self, value):
|
|
|
|
def _check_type_raw(self, value):
|
|
|
|
return value
|
|
|
|
return value
|
|
|
|
|
|
|
|
|
|
|
|