To separate concerns and make it easier to test set_directive, extract function ``set_directive_lines`` to do the line-wise search/replace, leaving ``set_directive`` to deal with the file handling. Part of: https://pagure.io/freeipa/issue/7288 Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>