@@ -226,7 +226,7 @@ def _convert(node):
226
226
227
227
FILE_COMMON_ARGUMENTS = dict (
228
228
src = dict (),
229
- mode = dict (),
229
+ mode = dict (type = 'raw' ),
230
230
owner = dict (),
231
231
group = dict (),
232
232
seuser = dict (),
@@ -574,6 +574,7 @@ def __init__(self, argument_spec, bypass_checks=False, no_log=False,
574
574
'int' : self ._check_type_int ,
575
575
'float' : self ._check_type_float ,
576
576
'path' : self ._check_type_path ,
577
+ 'raw' : self ._check_type_raw ,
577
578
}
578
579
if not bypass_checks :
579
580
self ._check_required_arguments ()
@@ -1360,15 +1361,23 @@ def _check_type_path(self, value):
1360
1361
value = self ._check_type_str (value )
1361
1362
return os .path .expanduser (os .path .expandvars (value ))
1362
1363
1364
+ def _check_type_raw (self , value ):
1365
+ return value
1366
+
1363
1367
1364
1368
def _check_argument_types (self ):
1365
1369
''' ensure all arguments have the requested type '''
1366
1370
for (k , v ) in self .argument_spec .items ():
1367
1371
wanted = v .get ('type' , None )
1368
- if wanted is None :
1369
- continue
1370
1372
if k not in self .params :
1371
1373
continue
1374
+ if wanted is None :
1375
+ # Mostly we want to default to str.
1376
+ # For values set to None explicitly, return None instead as
1377
+ # that allows a user to unset a parameter
1378
+ if self .params [k ] is None :
1379
+ continue
1380
+ wanted = 'str'
1372
1381
1373
1382
value = self .params [k ]
1374
1383
0 commit comments