dad858a ipa-adtrust-install: avoid failure when replica is offline

Authored and Committed by frenaud 3 years ago
    ipa-adtrust-install: avoid failure when replica is offline
    
    When ipa-adtrust-install --add-agents fails to connect to the
    replica (for instance because services are stopped on the replica),
    it should not exit on error but rather print an error message.
    
    The issue happens because of python2/python3 differences in the
    returned exceptions. As ipa-4-6 branch also supports python2,
    a socket.error exception is raised when the connection fails and
    must be properly caught.
    
    In python2, socket.error inherits from IOError.
    In python3, ConnectionRefusedError inherits from OSError, and
    IOError is an alias for OSError.
    
    Fixes: https://pagure.io/freeipa/issue/8345
    Reviewed-By: Francois Cami <fcami@redhat.com>
    
        
file modified
+1 -10