bd8748f Convert values using _SYNTAX_MAPPING with --delattr

2 files Authored by rcritten 2 years ago, Committed by abbra 2 years ago,
    Convert values using _SYNTAX_MAPPING with --delattr
    
    When an entry is loaded the incoming values are converted
    into python datatypes automatically based on the _SYNTAX_MAPPING
    value in ipaldap.
    
    When using delattr to remove a mapped value it will fail because
    the datatypes do not match up. For example date types are
    datetime.datetime structions and won't match a generalized time
    string.
    
    So try to map the value to delete using _SYNTAX_MAPPING before
    trying to remove the value. Fall back to trying to remove the
    raw value if the mapping fails.
    
    This won't work for some mapping types, DNs for example. Providing
    only the RDN value for a DN-type, manager for example, lacks the
    context to know how to construct the DN (RDN and contaner).
    
    Fixes: https://pagure.io/freeipa/issue/9004
    
    Signed-off-by: Rob Crittenden <rcritten@redhat.com>
    Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>