Avoid confusing warning when using file.line

file.line is internaly using file.managed without any source argument to
ensure file creation with the appropriate permissions.  file.managed has
its 'replace' parameter defaulting to True, resulting in the following
warning :

  Neither 'source' nor 'contents' nor 'contents_pillar' nor
  'contents_grains' was defined, yet 'replace' was set to 'True'. As
  there is no source to replace the file with, 'replace' has been set to
  'False' to avoid reading the file unnecessarily.

Setting explicitly replace to False solve this issue.

Signed-off-by: Marin Hannache <marin@cri.epita.net>
This commit is contained in:
Marin Hannache 2017-07-25 16:23:34 +02:00
parent 50c1635dcc
commit 2fd172e07b

View file

@ -3732,7 +3732,13 @@ def line(name, content=None, match=None, mode=None, location=None,
if not name:
return _error(ret, 'Must provide name to file.line')
managed(name, create=create, user=user, group=group, mode=file_mode)
managed(
name,
create=create,
user=user,
group=group,
mode=file_mode,
replace=False)
check_res, check_msg = _check_file(name)
if not check_res: