#6254 kinit_admin raises an exception if server uninstallation is called from test teardown with server not installed
Closed: Fixed Opened by ofayans.

Some tests have teardown methods that execute server uninstallation, which includes determining of domain level, which in turn has a kinit_admin call. If the test itself performs negative check (like that the server refuses to install with incorrect parameters), then during uninstallation the IPA is in fact not installed. Which causes kinit_admin call to raise an exception. The example output of such test is like this:

____ ERROR at teardown of TestReplicaPromotionLevel0.test_backup_restore ______
host = <ipatests.test_integration.host.Host vm-136.abc.idm.lab.eng.brq.redhat.com (replica)>
ignore_topology_disconnect = True, ignore_last_of_role = True
    def uninstall_master(host, ignore_topology_disconnect=True,
                         ignore_last_of_role=True):
        host.collect_log(paths.IPASERVER_UNINSTALL_LOG)
        uninstall_cmd = ['ipa-server-install', '--uninstall', '-U']
>       host_domain_level = domainlevel(host)
test_integration/tasks.py:664: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_integration/tasks.py:304: in domainlevel
    kinit_admin(host)
test_integration/tasks.py:656: in kinit_admin
    stdin_text=host.config.admin_password)
../pytest_multihost/host.py:246: in run_command
    command.wait(raiseonerr=raiseonerr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_multihost.transport.SSHCommand object at 0x7fea947b9810>
raiseonerr = True
    def wait(self, raiseonerr=True):
        """Wait for the remote process to exit
            Raises an excption if the exit code is not 0, unless raiseonerr is
            true.
            """
        if self._done:
            return self.returncode
        self._end_process()
        self._done = True
        if raiseonerr and self.returncode:
            self.log.error('Exit code: %s', self.returncode)
>           raise subprocess.CalledProcessError(self.returncode, self.argv)
E           CalledProcessError: Command '['kinit', 'admin']' returned non-zero exit status 1

To address this issue we need to set raiseonerr to False for this particular call.


master:

  • 5812af84a4a12528e969f14017e9675160b3faef Disabled raiseonerr in kinit call during topology level check

backported to 4-3 branch since the issue is also occuring there:

ipa-4-3:

  • fb6980d2263aae64ee35f2890542ed2b0ded9e02 Disabled raiseonerr in kinit call during topology level check

Metadata Update from @ofayans:
- Issue assigned to ofayans
- Issue set to the milestone: FreeIPA 4.3.3

Metadata