f1e12c7 Don't double-report any errors from pki-spawn failures

1 file Authored by rcritten 3 years ago, Committed by frenaud 3 years ago,
    Don't double-report any errors from pki-spawn failures
    
    The output from pki-spawn is already displayed to the user
    as well as a short traceback so re-displaying the CalledProcess
    error provides no value and only provokes confusion,
    particularly because it is condensed and includes embedded
    newlines.
    
    Re-raise the exception from None so that the traceback is
    removed and while there is still an immense traceback from
    the admintool class it is significantly shorter than before
    and removes:
    
    "During handling of the above exception, another exception occurred"
    
    The handling is in fact expected.
    
    This changes the user-facing installer output from:
    
      [1/28]: configuring certificate server instance
    Failed to configure CA instance: CalledProcessError(Command ['/usr/sbin/pkispawn', '-s', 'CA', '-f', '/tmp/tmpr5x2l0gm', '--debug'] returned non-zero exit status 1: 'INFO: Connecting to LDAP server at ldap://ipa.example.test:389\nINFO: Connecting to LDAP server at ldap://ipa.example.test:389\nDEBUG: Installing Maven dependencies: False\nERROR: KeyError: \'CA\'\n  File "/usr/lib/python3.9/site-packages/pki/server/pkispawn.py", line 575, in main\n    raise KeyError(\'CA\')\n\n')
    See the installation logs and the following files/directories for more information:
      /var/log/pki/pki-tomcat
      [error] RuntimeError: CA configuration failed.
    CA configuration failed.
    The ipa-server-install command failed. See /var/log/ipaserver-install.log for more information
    
    to
    
      [1/28]: configuring certificate server instance
    Failed to configure CA instance
    See the installation logs and the following files/directories for more information:
      /var/log/pki/pki-tomcat
      [error] RuntimeError: CA configuration failed.
    CA configuration failed.
    The ipa-server-install command failed. See /var/log/ipaserver-install.log for more information
    
    The output is similarly reduced in the installer log. There is no
    reason to acknowledge that a CalledProcessError was raised since
    the output is already available and it's just an intermediary.
    
    Hopefully this will encourage users to focus on the logs rather than
    the malformed traceback.
    
    https://pagure.io/freeipa/issue/8565
    
    Signed-off-by: Rob Crittenden <rcritten@redhat.com>
    Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
    Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>