#6255 Hostname backup fails if there is no temporary ipatests folder during execution
Closed: Fixed None Opened 7 years ago by ofayans.

Sometimes, if the testsuite consists of more than one class, the testfolder gets deleted during class teardown. This results in failures in tasks.apply_common_fixes method. It calls fix_hostname first, which expects the existing of ipatests folder and then the prepare_hosts method that creates this folder if it does not exist. The example test output is as follows:

test_integration/tasks.py:1153: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_integration/test_replica_promotion.py:64: in test_backup_restore
    tasks.install_replica(self.master, self.replicas[0])
test_integration/tasks.py:342: in install_replica
    apply_common_fixes(replica)
test_integration/tasks.py:141: in apply_common_fixes
    fix_hostname(host)
test_integration/tasks.py:163: in fix_hostname
    backup_file(host, paths.ETC_HOSTNAME)
test_integration/tasks.py:156: in backup_file
    ipautil.shell_quote(rmname)))
../pytest_multihost/host.py:246: in run_command
    command.wait(raiseonerr=raiseonerr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pytest_multihost.transport.SSHCommand object at 0x7fea91518b10>
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 'echo '/etc/hostname' >> '/root/ipatests/file_remove'' returned non-zero exit status 1

[[BR]]
To fix this we need to swap the calls of 'fix_hostname' and 'prepare_host' in ipatests.test_integration.tasks.applpy_common_fixes method


master:

  • fbc9179 Fixed incorrect sequence of method calls in tasks.py

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

7 years ago

Login to comment on this ticket.

Metadata