a70ce13 Add safe DirectiveSetter context manager

Authored and Committed by cheimes 6 years ago
    Add safe DirectiveSetter context manager
    
    installutils.set_directive() is both inefficient and potentially
    dangerous. It does not ensure that the whole file is written and
    properly synced to disk. In worst case it could lead to partially
    written or destroyed config files.
    
    The new DirectiveSetter context manager wraps everything under an easy
    to use interface.
    
    https://pagure.io/freeipa/issue/7312
    
    Signed-off-by: Christian Heimes <cheimes@redhat.com>
    Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
    
        
file modified
+54 -55