From 10fee0e368750cf4cd953db5700df59c7f611119 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 19 Feb 2014 13:20:52 -0600 Subject: [PATCH] Revert "Show hostname instead of IP in errors" This reverts commit eafeece243607eef8209eaa8c08eecc7d1098eb1. I was having problems with my newly-created devstack task hanging inexplicably. It turns out this commit was responsible. --- teuthology/orchestra/remote.py | 2 +- teuthology/orchestra/run.py | 16 +++++----------- teuthology/orchestra/test/test_remote.py | 1 - 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index 5711b6a1f8..e74c2e373b 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -56,7 +56,7 @@ class Remote(object): TODO refactor to move run.run here? """ - r = self._runner(client=self.ssh, name=self.name, **kwargs) + r = self._runner(client=self.ssh, **kwargs) r.remote = self return r diff --git a/teuthology/orchestra/run.py b/teuthology/orchestra/run.py index 0364cf8bcd..7bc5047668 100644 --- a/teuthology/orchestra/run.py +++ b/teuthology/orchestra/run.py @@ -189,14 +189,12 @@ class KludgeFile(object): self._wrapped.close() self._wrapped.channel.shutdown_write() - def run( client, args, stdin=None, stdout=None, stderr=None, logger=None, check_status=True, wait=True, - name=None ): """ Run a command remotely. @@ -210,7 +208,6 @@ def run( :param logger: If logging, write stdout/stderr to "out" and "err" children of this logger. Defaults to logger named after this module. :param check_status: Whether to raise CalledProcessError on non-zero exit status, and . Defaults to True. All signals and connection loss are made to look like SIGHUP. :param wait: Whether to wait for process to exit. If False, returned ``r.exitstatus`` s a `gevent.event.AsyncResult`, and the actual status is available via ``.get()``. - :param name: Human readable name (probably hostname) of the destination host """ r = execute(client, args) @@ -225,16 +222,12 @@ def run( if logger is None: logger = log - (host, port) = client.get_transport().getpeername() - - if name is None: - name = host - + (host,port) = client.get_transport().getpeername() g_err = None if stderr is not PIPE: if stderr is None: stderr = logger.getChild('err') - g_err = gevent.spawn(copy_file_to, r.stderr, stderr, name) + g_err = gevent.spawn(copy_file_to, r.stderr, stderr, host) r.stderr = stderr else: assert not wait, "Using PIPE for stderr without wait=False would deadlock." @@ -243,7 +236,7 @@ def run( if stdout is not PIPE: if stdout is None: stdout = logger.getChild('out') - g_out = gevent.spawn(copy_file_to, r.stdout, stdout, name) + g_out = gevent.spawn(copy_file_to, r.stdout, stdout, host) r.stdout = stdout else: assert not wait, "Using PIPE for stdout without wait=False would deadlock." @@ -270,7 +263,8 @@ def run( # signal; sadly SSH does not tell us which signal raise CommandCrashedError(command=r.command) if status != 0: - raise CommandFailedError(command=r.command, exitstatus=status, node=name) + (host,port) = client.get_transport().getpeername() + raise CommandFailedError(command=r.command, exitstatus=status, node=host) return status if wait: diff --git a/teuthology/orchestra/test/test_remote.py b/teuthology/orchestra/test/test_remote.py index 13e3c31043..dbff6ffc42 100644 --- a/teuthology/orchestra/test/test_remote.py +++ b/teuthology/orchestra/test/test_remote.py @@ -45,7 +45,6 @@ class TestRemote(object): client=fudge.inspector.arg.passes_test(lambda v: v is ssh), args=fudge.inspector.arg.passes_test(lambda v: v is args), foo=fudge.inspector.arg.passes_test(lambda v: v is foo), - name='jdoe@xyzzy.example.com' ).returns(ret) r = remote.Remote(name='jdoe@xyzzy.example.com', ssh=ssh) # monkey patch ook ook -- 2.39.5