From e16b9aa3a03ec2f824e04a97dca09b5806bc44f7 Mon Sep 17 00:00:00 2001 From: Marcus McCurdy Date: Mon, 2 Sep 2013 11:14:40 -0400 Subject: [PATCH] Improves lineinfile's error checking Line in file would raise a TypeError exception if the 'line' key was in params, but its value was None. --- files/lineinfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/lineinfile b/files/lineinfile index 29ff9603fdf..7dd38a3cf05 100644 --- a/files/lineinfile +++ b/files/lineinfile @@ -305,7 +305,7 @@ def main(): module.fail_json(rc=256, msg='Destination %s is a directory !' % dest) if params['state'] == 'present': - if 'line' not in params: + if params.get('line') is None: module.fail_json(msg='line= is required with state=present') # Deal with the insertafter default value manually, to avoid errors