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.
reviewable/pr18780/r1
Marcus McCurdy 11 years ago
parent 30f4d91c6a
commit e16b9aa3a0

@ -305,7 +305,7 @@ def main():
module.fail_json(rc=256, msg='Destination %s is a directory !' % dest) module.fail_json(rc=256, msg='Destination %s is a directory !' % dest)
if params['state'] == 'present': 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') module.fail_json(msg='line= is required with state=present')
# Deal with the insertafter default value manually, to avoid errors # Deal with the insertafter default value manually, to avoid errors

Loading…
Cancel
Save