Revert "Module params should default to str in most cases."
This reverts commit 9fae8501e2
.
Reverting for 2.0.1 -- this has been broken in the 2.0 tree for long
enough that some modules are relying on the broken behaviour. This fix
will definitely return for 2.1.0 and may return in 2.0.2 (impact needs
to be evaluated).
This commit is contained in:
parent
0ccbbe0c09
commit
9c049b757f
1 changed files with 3 additions and 12 deletions
|
@ -226,7 +226,7 @@ except ImportError:
|
|||
|
||||
FILE_COMMON_ARGUMENTS=dict(
|
||||
src = dict(),
|
||||
mode = dict(type='raw'),
|
||||
mode = dict(),
|
||||
owner = dict(),
|
||||
group = dict(),
|
||||
seuser = dict(),
|
||||
|
@ -572,7 +572,6 @@ class AnsibleModule(object):
|
|||
'int': self._check_type_int,
|
||||
'float': self._check_type_float,
|
||||
'path': self._check_type_path,
|
||||
'raw': self._check_type_raw,
|
||||
}
|
||||
if not bypass_checks:
|
||||
self._check_required_arguments()
|
||||
|
@ -1314,23 +1313,15 @@ class AnsibleModule(object):
|
|||
value = self._check_type_str(value)
|
||||
return os.path.expanduser(os.path.expandvars(value))
|
||||
|
||||
def _check_type_raw(self, value):
|
||||
return value
|
||||
|
||||
|
||||
def _check_argument_types(self):
|
||||
''' ensure all arguments have the requested type '''
|
||||
for (k, v) in self.argument_spec.items():
|
||||
wanted = v.get('type', None)
|
||||
if wanted is None:
|
||||
continue
|
||||
if k not in self.params:
|
||||
continue
|
||||
if wanted is None:
|
||||
# Mostly we want to default to str.
|
||||
# For values set to None explicitly, return None instead as
|
||||
# that allows a user to unset a parameter
|
||||
if self.params[k] is None:
|
||||
continue
|
||||
wanted = 'str'
|
||||
|
||||
value = self.params[k]
|
||||
|
||||
|
|
Loading…
Reference in a new issue