#4132 ipatests: Check if you can log into the host before preparing
Closed: Fixed None Opened 10 years ago by tbabej.

We should check and fail if the handler machine can not log into the host before trying to prepare it. Otherwise we get a misleading error like this:

[2014-01-21T14:08:03Z ipa.ipatests.test_integration.base.IntegrationTest] <INFO>: Preparing host hp-ml310g5-01.testrelm.com
[2014-01-21T14:08:03Z ipa.ipatests.test_integration.base.IntegrationTest] <INFO>: Adding hp-ml310g5-01.testrelm.com:/root/ipatests/env.sh to list of logs to collect
[2014-01-21T14:08:03Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.OpenSSHTransport] <DEBUG>: SSH invocation: ['ssh', '-l', 'root', '-o', 'ControlPath=/tmp/ipa.tests.sSfgVD/control', '-o', 'StrictHostKeyChecking=no', '-o', 'UserKnownHostsFile=/tmp/ipa.tests.sSfgVD/known_hosts', '-i', '/root/.ssh/id_rsa', 'hp-ml310g5-01.testrelm.com']
[2014-01-21T14:08:03Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd1] <DEBUG>: RUN ['-o', 'ControlMaster=yes', '/usr/bin/cat']
[2014-01-21T14:08:03Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.OpenSSHTransport] <INFO>: STAT /root/ipatests
[2014-01-21T14:08:03Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd2] <DEBUG>: RUN ['ls', '/root/ipatests']
[2014-01-21T14:08:05Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd2.err] <DEBUG>: Connection closed by 10.16.65.74
[2014-01-21T14:08:05Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd2] <DEBUG>: Exit code: 255
[2014-01-21T14:08:05Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.OpenSSHTransport] <INFO>: STAT /root
[2014-01-21T14:08:05Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd3] <DEBUG>: RUN ['ls', '/root']
[2014-01-21T14:08:08Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd3.err] <DEBUG>: Connection closed by 10.16.65.74
[2014-01-21T14:08:08Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd3] <DEBUG>: Exit code: 255
[2014-01-21T14:08:08Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.OpenSSHTransport] <INFO>: STAT /
[2014-01-21T14:08:08Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd4] <DEBUG>: RUN ['ls', '/']
[2014-01-21T14:08:10Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd4.err] <DEBUG>: Connection closed by 10.16.65.74
[2014-01-21T14:08:10Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd4] <DEBUG>: Exit code: 255
[2014-01-21T14:08:10Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.OpenSSHTransport] <INFO>: MKDIR /
[2014-01-21T14:08:10Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd5] <DEBUG>: RUN ['mkdir', '/']
[2014-01-21T14:08:12Z ipa.ipatests.test_integration.host.Host.hp-ml310g5-01.cmd5.err] <DEBUG>: Connection closed by 10.16.65.74

And one in the summary as well:

======================================================================
ERROR: test suite for <class 'ipatests.test_integration.test_legacy_clients.TestLegacyNssPamLdapdRedHat'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.7/site-packages/nose/util.py", line 469, in try_run
    return func()
  File "/usr/lib/python2.7/site-packages/ipatests/test_integration/test_legacy_clients.py", line 47, in setup_class
    super(BaseTestLegacyClient, cls).setup_class()
  File "/usr/lib/python2.7/site-packages/ipatests/test_integration/base.py", line 81, in setup_class
    cls.prepare_host(host)
  File "/usr/lib/python2.7/site-packages/ipatests/test_integration/base.py", line 110, in prepare_host
    tasks.prepare_host(host)
  File "/usr/lib/python2.7/site-packages/ipatests/test_integration/tasks.py", line 46, in prepare_host
    host.transport.mkdir_recursive(host.config.test_dir)
  File "/usr/lib/python2.7/site-packages/ipatests/test_integration/transport.py", line 93, in mkdir_recursive
    self.mkdir_recursive(parent_path)
  File "/usr/lib/python2.7/site-packages/ipatests/test_integration/transport.py", line 93, in mkdir_recursive
    self.mkdir_recursive(parent_path)
  File "/usr/lib/python2.7/site-packages/ipatests/test_integration/transport.py", line 94, in mkdir_recursive
    self.mkdir(path)
  File "/usr/lib/python2.7/site-packages/ipatests/test_integration/transport.py", line 330, in mkdir
    cmd.wait()
  File "/usr/lib/python2.7/site-packages/ipatests/test_integration/transport.py", line 154, in wait
    raise subprocess.CalledProcessError(self.returncode, self.argv)
CalledProcessError: Command '['mkdir', '/']' returned non-zero exit status 255

The patch was already submitted.

Metadata Update from @tbabej:
- Issue assigned to tbabej
- Issue set to the milestone: FreeIPA 3.3.5 (bug fixing)

7 years ago

Login to comment on this ticket.

Metadata